in reply to Re: Read two values from input
in thread Read two values from input
The only difference between the default split (/\s+/, $_ ) and split (' ', $_ ) is that in the first case a leading space will generate a null field. Whereas in the second case, this is suppressed.
The split on ' ', is a special case and although there is just a space there, it means any of the five white space characters: \f\t\r\n\0x40(space). Because both forms operate on all 5 white space characters, any trailing white space will be ignored in both syntax's (unless there is a specified field limit).
There are a lot of tricky special case things about Perl syntax.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Read two values from input
by Anonymous Monk on Nov 27, 2011 at 12:24 UTC |