while ( my $line = ) { my ( $second, $sixth ) = ( split //, $line )[1,5]; print $second, $sixth, "\n"; }