[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Split versus Join



At 14.48 97/2/19, Mark Manning/Metrica wrote:
>        @theLine = split( ")", $theCommand );
>        @theLine = split( "\)", $theCommand );
>        @theLine = split( '\)', $theCommand );
>        @theLine = split( /\)/, $theCommand );

A little bit of perspective to help y'all remember: the reason for this is
that in the split() function you are MATCHING text, so you use the regex
syntax.  It is in fact a regular expression you are using in the split()
function.  However, with join(), you are specifiying explicitly what text
to drop in, so you use quotes.

This would also be appropriate:

>        @theLine = split(m"\)", $theCommand );

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6