: : :
This message was edited by mdw1982 at 2004-2-19 4:8:30
: : :
This message was edited by mdw1982 at 2004-2-19 4:7:15
: : : : : The code i've used here,output the words horizontally.I want each
: : : : : word on a new line.I've even tried to put "\n", but it does not work
: : : : :
: : : : Ooops. Shoulda been:-
: : : :
: : : : @words = map { /^\s*(.+)$/s; $1 } @words;
: : : :
: : : : Need the s modifier so . catches the \n and $ doesn't match it. I shoulda just left you with the simpler alternative, which does work, and not bothered with this map one...
: : : :
: : : : : print $wfh "@words";
: : : : No "'s needed here.
: : : :
: : :
: : : What about this one?
: : :
:
:
: # open and read the file into array
: open ( FILE, "<your_textfile.txt" );
: @words = <FILE>;
: close(FILE);
:
: # open output file
: open ( OP, ">some_outputfile.txt" );
:
: # output the files contents to another file
: foreach my $line ( @words )
: {
: chomp( $line );
: # beginning spaces removal added later
: # cause was sleepy when I posted this early in
: # the morning
: $line =~ s/^\d+//;
: print OP "$line\n";
: }
: close(OP);
: exit;
:
:
: : Uhhhh...and where does it remove the blanks at the start of the line?
: :
: : Jonathan
:
:

I was a little sleepy this morning when I posted that and I understand better now that a regex is indeed necessary to clean the beginning of the line if there are spaces there. Ooooooooooops, my bad.
:
: I also realize that my code example is somewhat simpler, and probably less elegant, but then I'm a simple sort of guy.
:
Go get more coffee.
$line =~ s/^\d+//;
Should be:-
$line =~ s/^\s+//;
s for whitespace. d is for digits.
Jonathan
###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");