in reply to Script issue involves File Handling.

How about going surgical instead of clinical? suppose you got 150 wrestlers names, and that you're supposed to sort them alphabetically and you wanted to treat the combination of the wrestler's name, the cheer, the killer move as well as any other additional parameters as a unified data structure that can be expanded to contain other information about the same wrestler, examples of these data can be descriptions about his age, weight in pounds, winning matches, lost games, the association he's member of, a yes/no thingy if he was kicked in the butt by the Undertaker...etc.

Consider getting an insight into References, they're so powerful. Not belittling the other solutions here by toolic and ww for they are far more readable and constructed and these guys are more experienced than humble me, but I am showing you a TIMTOWTDI thing cuz a surgeon needs to know what there in the guts is :p

Here we go:

#!/usr/local/bin/perl use strict; use warnings; my %hash; while(<DATA>){ chomp; my ($name,$crowdReaction,$killerMove)=split /\|/; $hash{$name}=[] unless exists $hash{$name}; #to skip duplicate + wrestlers names just in case. push @{$hash{$name}}, $crowdReaction,$killerMove; } print "WRESTLER\tCrowd Reaction\tKiller Move\n"; print "_" x 50, "\n"; foreach my $name (sort keys %hash){ for(my $i=0;$i< length(@{$hash{$name}});$i++){ print "$name\t@{$hash{$name}}[$i]\t\t@{$hash{$name}}[+ ++$i]\n"; } } __DATA__ The Rock|Cheer|Rock Bottom Triple H|Boo|Pedigree Stone Cold|Cheer|Stone Cold Stunner
WRESTLER Crowd Reaction Killer Move __________________________________________________ Stone Cold Cheer Stone Cold Stunner The Rock Cheer Rock Bottom Triple H Boo Pedigree
N.B: The way you used the open function to open a file, you haven't provided arguments specifying if the file has been opened in modes of input, output, append...

Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.