Re: File Existance



(Bringing this back to the list)

On Wednesday 28 September 2005 21:09, you wrote:
> I don't get this to work. What am I doing wrong? Must the path be
> included? My program is like this:
>
> my $program = "ls";
>
> if (-e $program) {
> #execute program
> }
yes, it must include the full path:
foreach ('ls', '/bin/ls') {
if (-e $_) { print "$_ exists\n"; } else { print "$_ doesn't exist\n"; }
}
Prints:
ls doesn't exist
/bin/ls exists

--
Robin <robin@xxxxxxxxxxxxxxx> JabberID: <eythian@xxxxxxxxxxxxxxxxxxxxxx>

Hostes alienigeni me abduxerunt. Qui annus est?

PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D

Attachment:pgpQM7OrYqJk8.pgp
Description: PGP signature



Relevant Pages