in reply to Ending user input
use strict; # never go by without it! ;) rint "Enter your data and then it will print out in reverse order.\n"; my @input; while (<STDIN>){ chomp; last if m/done/i; # quit this loop if input # matches (case insensitive) the word 'done'. push @input, $_; # otherwise, add the word to the list } # Use 'for' loop instead of while if you need to # access array elements via an index variable. for (my $currentline = 1; $currentline <= scalar @input; $currentline +++) { my @words=split(/ /,$input[$currentline - 1]); #@words=reverse(@words); $input[$currentline - 1]=join(" ",@words,"\n"); } @input=reverse(@input); print(@input);
Sorry about that, Anonymous Monk! ;)while(<STDIN>){chomp;last if m/done/i;push @a, $_;}print@a;
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Ending user input
by Anonymous Monk on May 28, 2002 at 17:24 UTC | |
by DigitalKitty (Parson) on May 28, 2002 at 19:49 UTC |