Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: -s test option returns differently in some cases

by hdb (Prior)
on Oct 14, 2013 at 08:48 UTC ( #1058149=note: print w/ replies, xml ) Need Help??


in reply to Re^2: -s test option returns differently in some cases
in thread -s test option returns differently in some cases

There is a $ missing in

if (-s "myAbsPathToFile") {

Replies are listed 'Best First'.
Re^4: -s test option returns differently in some cases
by frogsausage (Sexton) on Oct 14, 2013 at 09:13 UTC

    You won't believe it but...

    print "# Command file is located at: $cmd_path\n" if (-e $cmd_path); # system("ls -l $cmd_path"); if (-s $cmd_path) {# $cmd_path) { print "Good to go"; } else { print "Failed: $!"; }

    gives "Failed: No such file or directory"

    print "# Command file is located at: $cmd_path\n" if (-e $cmd_path); system("ls -l $cmd_path"); if (-s $cmd_path) {# $cmd_path) { print "Good to go"; } else { print "Failed: $!"; }

    gives "Good to go"

    Same file, same code, same everything except that extra statement in between. An empty system(""); call does the same (works). Ideas?!

Re^4: -s test option returns differently in some cases
by frogsausage (Sexton) on Oct 14, 2013 at 08:53 UTC
    Indeed! I corrected typo after edit. I converted full path to variable again hence why.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058149]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2016-07-01 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (406 votes). Check out past polls.