On Thursday 12 September 2002 08:11 pm, Javeed SAR wrote:
> I have a statement as follows;
> I need to split them into 3 parts;
>
> * test_merge1          \\blrk35ed\views\test_merge1.vws
>
>
> LIke this:
> $var1 should have *
> $var2 should have test_merge1
> $var3 should have  \\blrk35ed\views\test_merge1.vws
>
>
>
> TIA
>
> Jav

Here's what I came up with. I had a bit of trouble with the leading '\\' on 
the path. Using /\s+\ in 'split' causes the the first '\' to be dropped. It's 
acting like a special character escape. So, after the split I put the leading 
'\' back in. 
Perhaps someone has a more efficient method of keeping the double backslashes 
during the 'split'. Hope this helps.

nyec

# begin 
my $string = '* test_merge1         \\blrk35ed\views\test_merge1.vws';
my ($var1, $var2, $var3) = split/\s+/,$string;

$var3 =~ s/^\\/\\\\/g;  #puts the double quote back in front

print "var1 is: $var1\n";
print "var2 is: $var2\n";
print "var3 is: $var3\n";

__END__

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to