use feature 'say'; while (<>) { chomp; if ($. % 4 == 2 ) { $_ = reverse; y/ACTG/TGAC/; } say; }