[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] NTK now, 2000-03-31 (fwd)



>>>>> "MAL" == Martin A Langhoff <martin@scim.net> writes:


  >> "autovivifying file handles",

  MAL>     I do not want to insult the list with my ignorance, but I
  MAL> read the announcement and I'm still trying to imagine what an
  MAL> 'autovivifyng file filehandle' is. Does in induce Perl to be more
  MAL> fun? or should I just ditch it until I'm so old I don't care for
  MAL> fun when I program?

kinda a neat feature. right now you have to do something like use symbol
or IO::* to get a handle you can pass around easily. but perl internals
can easily alocate a glob for you but it can be tricky getting it
without any symbols attached. one trick is:

	$handle = do { local( *FH ); \*FH } ;

but this is even easier:

	open( $handle, 'myfile' ) || die 'hot flaming death' ;

if $handle was undefined before that call, it will be autovivified with
an anonymous glob which can be used as a handle.

and i had enough fun today. 4 meetings and all involving a non-computer
business we are starting.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe