in reply to Re: Associative Array Trouble
in thread Associative Array Trouble
#!/usr/bin/perl -w use strict; open(TEST, 'test.txt') || die "Couldn't open it"; print "\nFile Opened\n\n\n"; my $i=1; my %list; while(<TEST>){ chomp; /(\w+)\s+(\w+)/; print "$i : $2\,$1\n"; $list{$i} = [$1,$2]; $i+=1; } foreach my $c (sort keys %list) { print "$list{$c}->[1],$list{$c}->[0]$/"} close(TEST); die "\n\n\nFile Closed\n";
Input file:
Emmitt Smith Walter Payton Barry Sanders Jim Brown Jeremy Smith
Oh yeah, what do you mean by dereferencing?
Thanks,
Emmitt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Associative Array Trouble
by tadman (Prior) on May 23, 2002 at 02:18 UTC |