Take extra caution with the backslash-scapes..

---
use 5.010;
use strict;
use warnings;

my $str1 = "F:\test\test123\test1233";  #Wrong! Backslash being expanded!
my $str2 = 'F:\test\test123\test1233';

my @array1 = split(/\\/, $str1);
my @array2 = split(/\\/, $str2);

my $n1 = @array1;
my $n2 = @array2;

say "\...@array1 has $n1 element(s)!";  # 1 element     
say "\...@array2 has $n2 element(s)!";  # 4 elements
---


> De: Chaitanya Yanamadala <dr.virus.in...@gmail.com>
> Assunto: Split function
> Para: "beginners" <beginners@perl.org>
> Data: Domingo, 28 de Novembro de 2010, 7:54
> How do i split a value like this
> F:\test\test123\test1233
> 
> please help me with this..
> 
> Regards
> Chaitanya
> 




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to