kumeperl has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
i am new to perl programming. i am trying to write a program to find number of occurence of '\' in an array file path. I tried the follwing code,
but it was not working, i mean it is not printng "found one". but errors = 0 please excuse my ignorance if my code is wrong. Reading the manual is confusing me further.. can anyone please help me with the code?@list = "C:\username\Sources"; foreach $arrchar (@list) { print "array char = $arrchar"; if($_ = /\\/) { print "\nfound one \n"; } }
Thanks,
Kumeperl
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: search for '\' in perl
by moritz (Cardinal) on Dec 12, 2011 at 13:53 UTC | |
Re: search for '\' in perl
by DStaal (Chaplain) on Dec 12, 2011 at 13:54 UTC | |
Re: search for '\' in perl
by tinita (Parson) on Dec 12, 2011 at 14:11 UTC | |
Re: search for '\' in perl
by Lotus1 (Vicar) on Dec 12, 2011 at 13:56 UTC | |
Re: search for '\' in perl
by ricDeez (Scribe) on Dec 12, 2011 at 15:45 UTC | |
Re: search for '\' in perl
by TJPride (Pilgrim) on Dec 12, 2011 at 17:50 UTC | |
by kumeperl (Initiate) on Dec 13, 2011 at 13:04 UTC | |
by Anonymous Monk on Dec 13, 2011 at 13:30 UTC | |
by TJPride (Pilgrim) on Dec 13, 2011 at 14:32 UTC | |
by Anonymous Monk on Dec 13, 2011 at 14:44 UTC |
Back to
Seekers of Perl Wisdom