Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: if -s clause on a FILEHANDLE

by Fletch (Bishop)
on Jun 08, 2004 at 14:42 UTC ( #362351=note: print w/replies, xml ) Need Help??


in reply to Re^2: if -s clause on a FILEHANDLE
in thread if -s clause on a FILEHANDLE

The select stuff is a hackish shortcut from the dawn of time (or at lest the perl4 days) to set autoflush on a handle without changing the current default output handle afterwards. The chunk inside the inner parens is a list consisting of the previous default output handle (what you were getting with my $svsel = select OUT;) and then setting $| on the default output handle (which is then OUT since the select executes first). The list value is subscripted to get just the first element (the old saved handle) and that's passed to select to reset the default output handle.

And no, you don't want  -s "@ftapes". -s gets the size of a file (either by name or for an already opened filehandle). Yours would attempt to find the size of a file named after the contents of @ftapes joined by $,. Using an array in a scalar context evaluates to the number of items in the array; if you found any items then @ftapes will have a non-zero number of elements and evaluate to a true boolean value.

Replies are listed 'Best First'.
Re^4: if -s clause on a FILEHANDLE
by drock (Beadle) on Jun 08, 2004 at 21:43 UTC
    Is there a ideal way to "touch" a file instead of opening a file then >$foo it? for example,
    my $foo="/tmp/ftapes_runfile"; open (RUNFILE, ">$foo") || die "could not open runfile: $!;" close (RUNFILE);
    thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://362351]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2023-12-01 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?