SPUG: Reading records from a filehandle or a scalar

Joe Slagel slagel at geospiza.com
Thu Apr 26 12:22:23 CDT 2001


Does anyone know of a cute  trick to be able to read records
from either a filehandle or a scalar.  I guess you would
need to treat the scalar as a file handle in order to get
this to work.

Something like:

sub getRec
   {
   my $in = shift;

   # if $in is a scalar...do some magic

   my $rec = readline( $in );
   }

Thanks,
Joe

--
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