Skip to main content
added 72 characters in body
Source Link
Nahuel Fouilleul
  • 8.6k
  • 1
  • 10
  • 18

Perl 5, 17 + 2 (-pl) = 19 bytes

odd lines reversed

$_=reverse if$.%2

even lines reversed

$_=reverse if$|--

After @Martin's comment : input needs to have a trailing linefeed.

try it online

Perl 5, 17 + 2 (-pl) = 19 bytes

$_=reverse if$.%2

After @Martin's comment : input needs to have a trailing linefeed.

try it online

Perl 5, 17 + 2 (-pl) = 19 bytes

odd lines reversed

$_=reverse if$.%2

even lines reversed

$_=reverse if$|--

After @Martin's comment : input needs to have a trailing linefeed.

try it online

deleted 51 characters in body
Source Link
Nahuel Fouilleul
  • 8.6k
  • 1
  • 10
  • 18

Perl 5, 17 + 2 (-pl) = 19 bytes

$_=reverse if$|++if$.%2

try it online After @Martin's comment : input needs to have a trailing linefeed.

try it online

Perl 5, 17 + 2 (-pl) = 19 bytes

$_=reverse if$|++

try it online

Perl 5, 17 + 2 (-pl) = 19 bytes

$_=reverse if$.%2

After @Martin's comment : input needs to have a trailing linefeed.

try it online

Source Link
Nahuel Fouilleul
  • 8.6k
  • 1
  • 10
  • 18

Perl 5, 17 + 2 (-pl) = 19 bytes

$_=reverse if$|++

try it online