SPUG: Reading records from a filehandle or a scalar

Joe Slagel slagel at geospiza.com
Thu Apr 26 16:54:59 CDT 2001


Colin Meyer wrote:

> Try IO::Scalar:
>
> #!/usr/local/bin/perl
>
> use IO::Scalar;
>
> my $a=<<'eof';
> line one
> 2nd line
> larry says perl6 will use .'s to designate method calls:
> $obj.meth(arg1); # a different char will mean concatenate
> eof
>
> tie *FILE, 'IO::Scalar', \$a;
>
> while (<FILE>) {
>   print;
>   $count++;
> }
>
> print "\n\n$count lines\n";

Great! Thanks!!

--
Joe Slagel
Geospiza, Inc.
3939 Leary Way NW, Seattle WA 98107
(206) 633-4403
slagel at geospiza.com




 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list