in reply to Split and empty strings
This code prints out the following:#!/usr/bin/perl -w $_ = "The quick\n\nbrown fox\njumped."; print "-------------\n"; foreach (/(.*)/gm){ print "[$_]\n"; } print "-------------\n"; foreach (split/\n/){ print "[$_]\n"; } print "-------------\n";
So, while it may look the same, it really isn't.------------- [The quick] [] [] [brown fox] [] [jumped.] [] ------------- [The quick] [] [brown fox] [jumped.] -------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Bother (Re: Re: Split and empty strings)
by andye (Curate) on Apr 10, 2001 at 20:03 UTC | |
by davorg (Chancellor) on Apr 10, 2001 at 20:28 UTC | |
by Rhandom (Curate) on Apr 10, 2001 at 20:45 UTC | |
by chromatic (Archbishop) on Apr 11, 2001 at 00:44 UTC | |
by Rhandom (Curate) on Apr 10, 2001 at 20:39 UTC | |
by stephen (Priest) on Apr 10, 2001 at 21:15 UTC | |
by tilly (Archbishop) on Apr 10, 2001 at 22:25 UTC |