kapila has asked for the wisdom of the Perl Monks concerning the following question:
I actually want to separate & get values in array for below example.1.74,1.75,test/document.txt
But its working fine when i run standalone but in my app some issue which i am not able to figure out. When i hard code $aa='1.74 --> 1.75'; then i can split. But under this code its not splitting, even backslash with (--\>) also tried but no help. I have used ref(\$aa) also its showing SCALAR. Not sure why i am not able to split $aa. can experts help me here.
$text='--------------- 1.74 --> 1.75 :test/document.txt; sub func { my ($text) = (@_); $text =~ s/[\s|\n]*//g; $text =~ s/^[---]+//; my ($aa,$cd)=split(/:/,$text); my ($values,$cf)= split(/-->/,$aa); print "$values,$cf\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split using special charater data type scalar
by aitap (Curate) on Mar 25, 2013 at 13:18 UTC | |
|
Re: Split using special charater data type scalar
by jwkrahn (Abbot) on Mar 25, 2013 at 18:42 UTC | |
|
Re: Split using special charater data type scalar
by hdb (Monsignor) on Mar 25, 2013 at 13:04 UTC |