flexvault has asked for the wisdom of the Perl Monks concerning the following question:
Usually when I use 'split', I define the separator as a non-printable character:
perl -e '$sep=chr(254);$s="85$sep"."mat\@com";($key,$email)=split($sep +,$s);print"$key\t$email\n";'
And the result is:
Now a client wants to see the separator in the 'select' drop down box, so I defined the separator with the following:85 mat@com
And the result is:perl -e '$s="85|mat\@com";$sep="\|"; ($key,$email)=split($sep,$s); pri +nt "$key\t$email\n";'
8 5
If I do it this way, it works:
perl -e '$s="85|mat\@com";($key,$email)=split(/\|/,$s);print "$key\t$e +mail\n";'
I know "|" is a special character, but what is going on?
Regards...Ed
"Well done is better than well said." - Benjamin Franklin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What am I doing wrong with 'split'
by rnewsham (Curate) on Aug 11, 2013 at 09:41 UTC | |
by flexvault (Monsignor) on Aug 11, 2013 at 10:08 UTC | |
|
Re: What am I doing wrong with 'split'
by Laurent_R (Canon) on Aug 11, 2013 at 10:45 UTC | |
|
Re: What am I doing wrong with 'split'
by AnomalousMonk (Archbishop) on Aug 11, 2013 at 17:28 UTC |