in reply to how to make first element of an string as a the array name
#!/usr/bin/perl -w use strict; my %lines; open my $file, "<data.txt" or die "can't open: $!"; while(<$file>) { (my $key, my $stuff) = m/^([^,]*),(.*)/; my @data = split(",", $stuff); $lines{$key} = \@data; } # do something... print @{$lines{"IL12::1::329"}};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to make first element of an string as a the array name
by koleti (Novice) on Nov 15, 2007 at 01:11 UTC |