|
Prev: How to install perl's module without internet connection?
Next: "Util.obj : error LNK2001: unresolved external symbol _Perl_seed"
From: sureone on 23 Jan 2006 20:36 Could anybody give a sample code for this question? Thanks!
From: John W. Krahn on 23 Jan 2006 20:50 sureone(a)gmail.com wrote: > Could anybody give a sample code for this question? if ( -e 'filename' ) { print "'filename' exists.\n"; } perldoc -f -e perldoc -f stat John -- use Perl; program fulfillment
From: Samwyse on 24 Jan 2006 00:53 John W. Krahn wrote: > sureone(a)gmail.com wrote: > >>Could anybody give a sample code for this question? > > if ( -e 'filename' ) { > print "'filename' exists.\n"; > } John, John, John. *sigh* You didn't answer his question. You should have said, "Yes", and then given the perldoc references.
From: Juha Laiho on 24 Jan 2006 10:20
"John W. Krahn" <krahnj(a)telus.net> said: >sureone(a)gmail.com wrote: >> Could anybody give a sample code for this question? > >if ( -e 'filename' ) { > print "'filename' exists.\n"; > } However, be careful if later on performing any action based on the knowledge that at some point in the history the file did exist. Most often, one is interested, whether a piece of data can be read from a file - and in this context it'd be better to attempt to open the file and read the data. Just encapsulate the functionality performing this to allow an upper level to process and report the error appropriately. -- Wolf a.k.a. Juha Laiho Espoo, Finland (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++ "...cancel my subscription to the resurrection!" (Jim Morrison) |