in reply to Re^2: Is it possible to split a hash key?
in thread Is it possible to split a hash key?
... The difference is that the regex is not the string itself (/ /) but /\s+/
...not to forget the subtle, additional magic of ' ' vs. /\s+/ in the handling of leading whitespace. Compare
my $s = " foo bar baz"; print join("|", split /\s+/, $s), "\n"; # prints |foo|bar|baz print join("|", split ' ', $s), "\n"; # prints foo|bar|baz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Is it possible to split a hash key?
by Anno (Deacon) on Jul 29, 2007 at 13:23 UTC | |
by diotalevi (Canon) on Jul 29, 2007 at 17:31 UTC |