Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Why my code above gives:perl -MData::Dumper -e ' $str = " STRING "; @ar = split(/\s+/,$str); print Dumper \@ar;'
But I want simply this:$VAR1 = [ '', 'STRING' ];
What's wrong with my regex above? Thanks so much.$VAR1 = [ 'STRING' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Nagging space after splitting
by Zaxo (Archbishop) on May 31, 2005 at 06:16 UTC | |
|
Re: Nagging space after splitting
by ivancho (Hermit) on May 31, 2005 at 06:18 UTC | |
|
Re: Nagging space after splitting
by dbwiz (Curate) on May 31, 2005 at 06:57 UTC | |
|
Re: Nagging space after splitting
by tlm (Prior) on May 31, 2005 at 06:19 UTC | |
|
Re: Nagging space after splitting
by ikegami (Patriarch) on May 31, 2005 at 07:02 UTC | |
|
Re: Nagging space after splitting
by tphyahoo (Vicar) on May 31, 2005 at 08:00 UTC | |
|
Re: Nagging space after splitting
by tchatzi (Acolyte) on May 31, 2005 at 07:41 UTC |