in reply to Re: directory exists
in thread directory exists

Hello, thank u for the very fast reply. I tried the syntax you posted but it doesnt work for me ..for some reason. my $dev = '/dev'; if (-e $dev && -d _) { # print "Directory exists \n"; print $dev, ' directory exists.', $/; } but If I use perl -wle '$x=q(/dev); print "OK" if -d $x' , it works fine from the command line

Replies are listed 'Best First'.
Re^3: directory exists
by Zaxo (Archbishop) on Jun 03, 2005 at 00:47 UTC

    It works for me, do you have shell quoting problems?

    $ perl -e'my $dev = "/dev";if (-e $dev and -d _) {print $dev," directo +ry exists.",$/}' /dev directory exists. $

    After Compline,
    Zaxo

Re^3: directory exists
by tlm (Prior) on Jun 03, 2005 at 00:46 UTC

    You may be "suffering from buffering." Try switching off output buffering by adding the line $| = 1 somewhere before the print statement.

    the lowliest monk

Re^3: directory exists
by ambrus (Abbot) on Jun 03, 2005 at 19:09 UTC

    Dear anonymous monk. It would be wise if you used code tags when entering multi-line code like the one above, because this way it's not clear where the end of the comment is.

Re^3: directory exists
by Anonymous Monk on Jun 06, 2005 at 02:55 UTC
    Hello everyone, THANK YOU FOR ALL YOUR REPLIES...THE SYNTAX YOU SUGGESTED WORKED ONCE I CHANGED A FEW LINES OF CODE IN ANOTHER PLACE..... thank you very much