View Single Post
Old Feb 21st, 2005, 5:59 PM   #2
Mad_guy
Hobbyist Programmer
 
Mad_guy's Avatar
 
Join Date: Oct 2004
Location: Sandstorm, Techno Club
Posts: 239
Rep Power: 5 Mad_guy is on a distinguished road
Send a message via AIM to Mad_guy Send a message via MSN to Mad_guy
Use the following:

#!/perl/bin
my @words;
open(FILE, "<file.txt") or die("Can't open file.");
while($currentline = <FILE>) {
 chomp($currentline);
 push(@words,$currentline);
}
close(FILE);
foreach $word (@words) {
 print $word." ";
}
print "\n\nDone. Hit RETURN to exit...";
$exit = <STDIN>;
Taa-daa.

Last edited by Mad_guy; Feb 21st, 2005 at 6:02 PM.
Mad_guy is offline   Reply With Quote