EmmittSmith has asked for the wisdom of the Perl Monks concerning the following question:
This program is supposed to take a last name, a comma, and a first name(in that order) and print the first name followed by the last. It works great, I was just wondering if my program was efficent; I want to see if there's some neat tricks I'm overlooking. Thanks.
open(TEST, 'test.txt') || die "Couldn't open it"; $i=1; while(<TEST>){ ($lname[$i], $fname[$i]) = split(','); $i+=1; } close(TEST); open(BTEST, '>test.txt'); $b=0; foreach (@fname) { chomp; print BTEST "$_ $lname[$b]\n"; $b+=1; } close(BTEST);
-Emmitt
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Refining my Program
by Kanji (Parson) on May 24, 2002 at 22:58 UTC | |
by mephit (Scribe) on May 25, 2002 at 04:43 UTC | |
Re: Refining my Program
by cLive ;-) (Prior) on May 24, 2002 at 23:10 UTC | |
Re: Refining my Program
by DamnDirtyApe (Curate) on May 24, 2002 at 22:33 UTC | |
Re: Refining my Program
by Anonymous Monk on May 24, 2002 at 23:00 UTC | |
Re: Refining my Program
by Anonymous Monk on May 25, 2002 at 20:51 UTC |