#!/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
In reply to Re^2: search for '\' in perl
by kumeperl
in thread search for '\' in perl
by kumeperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |