Excellent Maresia! Here's a couple of different ways you can do it. Note that double-quotes automatically 'interpolate' variables (ie. expands variables to their values), so you can even do "$rows\n"; instead of $rows."\n" :)
my %my_data = ( names => $some_data);
my $my_data_ref = \%my_data;
my @all_names = split /\n/, $my_data_ref->{names};
for (@all_names){
print "$_\n";
}
# or even skip creating the @all_names array altogether
print "$_\n" for split /\n/, $my_data_ref->{names};
I wouldn't recommend the latter unless you're really just doing something with the extracted information immediately on the spot. |