Thanks to everyone for the effort to look into this. Actually I wrote this email 2 days ago and have no
idea how come it got published today. Anyway my pattern was '$#$' and after putting the backslashes
into the pattern it seemed to work i.e. '\$\#\$'. Any idea why that would work?? Was the parser looking
for a value of $#.
 
thanks again to all.
----- Original Message -----
To: Sumit
Sent: Thursday, January 02, 2003 8:14 PM
Subject: Re: Variable in split function

What does your $Line look like?
Your code works fine for me when I use something like this:
 
$pattern = ":";
$Line = "A:B:C:D:E";
@Arr = split(/$pattern/, $Line);
print "@Arr", "\n";
print $Arr[0], "\n";
Kind regards,
Trevor Joerges
----------------------------------------------------
$_=q;rrUSFWPSZK.ZKPFSHFT,rkvtuZbopuifsZQZibdl
rrqpxfsfeZcyZQ,,riuuq://xxx.%.dpn,ru~@%.dpn
,,rrr8-),,;;s;\~;kpfshft;g;s;\%;tfoenjnf;g;y;B-x;A-w;;
s;P;perl;g;s;,;\n;g;s;Y; ;g;s;q;\t;g;print;
----------------------------------------------------
----- Original Message -----
From: Sumit
Sent: Monday, December 30, 2002 5:44 PM
Subject: Variable in split function

Hi all,
Can we use a variable in the /PATTERN/ argument of the split function. I tried it but was not able
to get it to work. Is there something I am missing??
 
$pattern = ":";
@Arr = split(/$pattern/, $Line);
 
puts the whole $Line as the first element in the array without splitting.
 
Thanks in advance and a
Happy New Year.

Reply via email to