in reply to Extracting data from a 2D array
In a single line ...
my @lastnames = map { (split ",")[1] } split "\n", $scalar;
Uses an array slice; the map returns the second element of each line.
HTH!
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
|
|---|