CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Beastie] umm...: Edit Log



KevinR
Veteran


Apr 10, 2009, 2:02 PM


Views: 2055
Re: [Beastie] umm...

Like I said before, you seem to have a lack of the fundamentals of perl, your code is very tortured to do simple things, but I can't teach you perl. These lines are certainly wrong:

if ($subdirs[$i]!="/proc")

!= is used for comparing numbers, not strings. Since you are running perl with the -w switch you should be getting warnings associated with those lines. Try this simple test:


Code
use warnings; 
$foo = 'bar';
if ($foo != 'blah') {
print "Foo!";
}


Argument "blah" isn't numeric in numeric ne (!=) at script line 3.
Argument "bar" isn't numeric in numeric ne (!=) at script line 3.

Then look up perls string comparison operators:

eq
ne
gt
lt
cmp
-------------------------------------------------


(This post was edited by KevinR on Apr 10, 2009, 2:03 PM)


Edit Log:
Post edited by KevinR (Veteran) on Apr 10, 2009, 2:03 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives