Hi Try this one

Make use of \Q....\E format.

$subrecdelim = '^';

$mystr = 'cat^dog^pony^rat';

@array = split(/\Q$subrecdelim\E/, $mystr);

foreach (@array) {
  print " - $_\n";
}

Cheers.

Regards,
Prasad

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
vega, james
Sent: Monday, November 01, 2004 10:33 PM
To: Perl-Win32-Users
Subject: RE: split and ^ character


> I'm trying to figure how to get the following code to work.  
> I've tried a 
> few combos, but nothing seems to get it right.  I'm guessing 
> it's something 
> simple, but I couldn't nail down what it was.  I realize that 
> ^ is a special 
> operator but I don't see a way to escape it, given that it's 
> input from a 
> scalar variable.
> 
> 
> $subrecdelim = '^';
> 
> $mystr = 'cat^dog^pony^rat';
> 
> @array = split(/$subrecdelim/, $mystr);

@array = split(/\Q$subrecdelim\E/, $mystr);

\Q - Quotes nonword characters until \E

> foreach (@array) {
>   print " - $_\n";
> }
> 
> 
> 
> Any hints would be appreciated.
> 
> Thanks!
> Paul ---
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to