V
Vishal
Her is a simple PERL file: spl.pl
$arg=shift ;
@in_arr= split /,/, $arg ;
print("\n in_arr 0 is $in_arr[0]");
print("\n in_arr 1 is $in_arr[1]");
print("\n in_arr 2 is $in_arr[2]");
print("\n in_arr 3 is $in_arr[3]");
print("\n in_arr 4 is $in_arr[4] \n");
When I execute the above perl file; it's give the following output :
perl spl.pl a,abc,"def,ijhk",lmn
in_arr 0 is a
in_arr 1 is abc
in_arr 2 is def
in_arr 3 is ijhk
in_arr 4 is lmn
But I want the output as:
in_arr 0 is a
in_arr 1 is abc
in_arr 2 is def,ijhk
in_arr 3 is lmn
in_arr 4 is
That is: the split function should not search in the Pattern which are
present in the quotes ("").
If any of your friends knows well about this "PERL/split"; pl pass on
this junk code to him for immediate help. Or if you know any Perl guy
then pass me his/her mail ID.
Please reply ASAP.
Thanks & Regards,
Vishal Anand
$arg=shift ;
@in_arr= split /,/, $arg ;
print("\n in_arr 0 is $in_arr[0]");
print("\n in_arr 1 is $in_arr[1]");
print("\n in_arr 2 is $in_arr[2]");
print("\n in_arr 3 is $in_arr[3]");
print("\n in_arr 4 is $in_arr[4] \n");
When I execute the above perl file; it's give the following output :
perl spl.pl a,abc,"def,ijhk",lmn
in_arr 0 is a
in_arr 1 is abc
in_arr 2 is def
in_arr 3 is ijhk
in_arr 4 is lmn
But I want the output as:
in_arr 0 is a
in_arr 1 is abc
in_arr 2 is def,ijhk
in_arr 3 is lmn
in_arr 4 is
That is: the split function should not search in the Pattern which are
present in the quotes ("").
If any of your friends knows well about this "PERL/split"; pl pass on
this junk code to him for immediate help. Or if you know any Perl guy
then pass me his/her mail ID.
Please reply ASAP.
Thanks & Regards,
Vishal Anand