in reply to dumb split question

not quite sure why yours didn't work, unless you used it incorrectly.
#!/usr/bin/perl -w use strict; my $text="blah blah\nblah\nblah\nblah\nblah\nyadda yadda yadda\n"; my @lines=split /\n/, $text; #replace with split(/\n/,$text); at will print "This: $_\n" for @lines;
-----BEGIN GEEK CODE BLOCK----- Version: 3.1 GPA/P/S d+ s++:+ a--- C++ UL++ P++>++++ L++ E W++ N o? K? w-- !O M- V? + PS++ PE- Y PGP- t 5- X+ R* tv-- b++ !DI D---(+) G e- h-- r++ y? ------END GEEK CODE BLOCK-----
UPDATE: Minor cosmetic change at tach's suggestion

Replies are listed 'Best First'.
Re: Re: dumb split question
by tachyon (Chancellor) on Mar 24, 2003 at 00:59 UTC

    Why not use trailing operators?

    print "This: $_\n" for @lines;

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print