in reply to Re: How can you split inside pop?
in thread How can you split inside pop?
\w isn't the same as \S. Try "string's" for a very good reason why this doesn't do what you expect. Also, suppose you have the string "this string has a space at the end ". Your snippet doesn't work properly yet split does since any null fields at the end are stripped. To get the same behavior, you'd need something like the following:
print $str =~ /(\S+)\s*$/;
As for speed, it is faster.
|
|---|