[wplug] Slightly OT- Perl issue

Christopher DeMarco cdemarco at fastmail.fm
Thu Mar 10 10:44:47 EST 2005


On Thu, 10 Mar 2005 10:26:25 -0500 (EST), "beer" <beer at cmu.edu> said:

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

You're not thinking straight ;)  No offense intended, but your mental
model likely includes a cloud labeled "magic happens here"...  Look at
your two examples; they both use <filename> differently - how is Perl
supposed to know what you want?  

In your first example you loop over <filename>; in the second you read
once from <filename>.  <filename> returns the first "line" (usually
newline, may be redefined by assigning to $/) so you're only getting the
first line.

> 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. :)

Without a bigger picture of your code, the only hint I can give is,
rather than slurping your .tar into a scalar, why not use one of the
CPAN modules (Archive::*, IIRC) that lets you manipulate .tar archives
directly?
-- 
~ You are in a maze of twisty passages, all alike.

  Christopher DeMarco
  cdemarco at fastmail.fm
  +6013 389 5658



More information about the wplug mailing list