RICHARD FERNANDEZ wrote:
 Hi Tom, thanks for the reply.

  my $old_name = "$company.$ext.$date";
  my $new_name = "$old_name.gz";
  warn "File '$old_name' is empty" if -z $old_name;
  warn "File '$old_name' isn't really a file" unless -f _;
  unlink $new_name;  # whether it's there or not
  gzip $old_name => $new_name,
    BinModeIn => 1
      or do {
        warn "Failed to gzip file: '$old_name': $GzipError";
        next DOTDONE;
      };
  warn "File '$new_name' not created as expected"
    unless -f $new_name and -s _;


I made the changes you suggested and re-ran it. The program just comes
back to a prompt. No warnings, no nothing, and still no data in the
gzip'd file!

Your code, though, prompts a question on syntax. In 2 places you specify
an underscore without a '$' in front of it. This is the first time I've
seen this. Running 'perl -c' says the syntax is clean, but I couldn't
find any reference to that usage in perlsyn. Is the '$' implied because
of the context?

Can you please explain or point me to the doc? Thanks.

perldoc -f -s
[ SNIP ]
        If any of the file tests (or either the "stat" or "lstat"
        operators) are given the special filehandle consisting of a
        solitary underline, then the stat structure of the previous file
        test (or stat operator) is used, saving a system call.  (This
        doesn’t work with "-t", and you need to remember that lstat()
        and "-l" will leave values in the stat structure for the
        symbolic link, not the real file.)  (Also, if the stat buffer
        was filled by an "lstat" call, "-T" and "-B" will reset it with
        the results of "stat _").  Example:



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to