Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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?
[1nickt]: If 1nickt is the some guy, that's not what he said.
[GotToBTru]: thepkd might not know about last hour of cb
[1nickt]: my $x = $aohoaoh->[0]->{' foo'}->[0]->{'bar' }; should work
[thepkd]: its not $aohoaoh->[0]. its $aohoaoh[0]->{'foo '}. Tried it. Its working. Thnaks
[thepkd]: Hey 1nickt sorry man. What
[GotToBTru]: a ref too far ;)
[thepkd]: Yes this is my first time in cb. Trying to work my way around.
[JohnCub]: "A ref too far" would make a good title for anyone's perl memoirs
[thepkd]: Anyways it works with $aohoaoh[0]->{'foo '}[0]->{'bar'}

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2016-12-06 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (105 votes). Check out past polls.