[wplug] Slightly OT- Perl issue

beer beer at cmu.edu
Thu Mar 10 10:26:25 EST 2005


I know this is a little off-topic but I also know there are a number of perl hackers in this group so I figured I'd start here first.

So I am trying to read a file into a scalar.  The typical newbie approach works fine:

open FILE "<filename";
while( <FILE> ) {
 $scalar .= $_;
}
close FILE;

But if I try to slurp the file in:

open FILE "<filename";
$scalar = <filename>;

I end up not getting all of the data.

The bigger picture of this code is this:

1. Connect to database and retrieve records which contain files.
2. Create tar archive and insert files into it.
3. Gzip tar archive
4. Read archive into scalar

I do have a working version of the code but I am trying to polish the solution.  If anyone has some insights I'd love to hear them. :)

Thanks

-b



More information about the wplug mailing list