Re: File Existance
- From: robin@xxxxxxxxxxxxxxx (Robin)
- Date: Wed, 28 Sep 2005 21:20:14 +1200
(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
- References:
- File Existance
- From: gustav
- Re: File Existance
- From: Robin
- File Existance
- Prev by Date: Re: File Existance
- Next by Date: Strange error: PerlRun
- Previous by thread: Re: File Existance
- Next by thread: Strange error: PerlRun
- Index(es):
Relevant Pages
|