One place you're going wrong (and, sorry to be blunt, but there are a *lot* of places where you're going wrong here):
Your openfile subroutine loads all the lines of the file into the @file array, and closes the file. Yet later, when you're trying to sort the data, you're attempting to read from the filehandle you've already closed. Instead, loop over the array that holds the file's contents (you might check out map for this sort of thing).
Another place: check out Perl's built-in sort function, it will save you many a headache. (perlfunc:sort or perldoc -f sort on your own system).
Good luck!
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"'
In reply to Re: Please help...not certain why my code does not work.
by arturo
in thread Please help...not certain why my code does not work.
by Satanya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |