Home: Perl Programming Help: Beginner:
-e and -s switches?



kicsihun
New User

Aug 19, 2009, 5:13 AM


Views: 1117
-e and -s switches?

Hi! I'm trying to understand a perl script. There are some switches (I guess) used, and I can't seem to find their role/use.
The code looks like:
my $filename ="doc";
my $filename1 = -s $filename;
while( -e $filename && $filename1 == -s $filename )

What is the role or use of -e and -s?

Thanks


vinodkaushik
Novice

Aug 19, 2009, 5:21 AM


Views: 1116
Re: [kicsihun] -e and -s switches?

following is the description of these switches.

-s : File is a socket
-e : File exists.


FishMonger
Veteran / Moderator

Aug 19, 2009, 7:22 AM


Views: 1112
Re: [vinodkaushik] -e and -s switches?

-s (lowercase)
-s File has non-zero size (returns size).

-S (uppercase)
-S File is a socket.


kicsihun
New User

Aug 19, 2009, 7:59 AM


Views: 1109
-e and -s switches?

Thanks a lot! WinkSmile