A split-based solution for the second file is even easier:while (<DATA>) { my ( $name, $initial ) = ( split / / )[ 1, 2 ]; $initial = substr $initial, 0, 1; say "$name $initial"; } __DATA__ 0. Amber BYU 1. Kim BGSU 2. Kim Washington
while (<DATA>) { chomp; ( undef, my $line ) = split / /, $_, 2; say $line; } __DATA__ 0. J 1. B F K 2. A I J
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: combining lists along with a regex
by CountZero
in thread combining lists along with a regex
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |