in reply to Re: search for '\' in perl
in thread search for '\' in perl
#!/usr/bin/perl -w use strict; use warnings; my $count; my @list = 'C:\username\Sources'; chomp @list; #print OUTPTR "$_\n" foreach @list; foreach my $arrchar (@list) { print "array char = $arrchar"; if($arrchar =~ m/\\/) { print "\nfound one \n"; $count += 1; } else { print"\n i am in else \n" } } print "value of count = $count";
the result is
array char = C:\username\Sources
found one
value of count = 1
i am expecting count = 2. again i am not sure why it is not working properly.regards,
kumeperl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: search for '\' in perl
by Anonymous Monk on Dec 13, 2011 at 13:30 UTC | |
|
Re^3: search for '\' in perl
by TJPride (Pilgrim) on Dec 13, 2011 at 14:32 UTC | |
by Anonymous Monk on Dec 13, 2011 at 14:44 UTC |