develooper Front page | perl.beginners | Postings from February 2002

RE: Formats

Thread Previous | Thread Next
From:
ABhagwandin
Date:
February 1, 2002 10:25
Subject:
RE: Formats
Message ID:
9EB4129CCB85D411AE980000BC1175B605E68326@MAIL1.sts-systems.ca
thanks a lot!

-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:jeffp@crusoe.net]
Sent: Friday, February 01, 2002 1:19 PM
To: ABhagwandin@STSSystems.com
Cc: beginners@perl.org
Subject: Re: Formats


On Feb 1, ABhagwandin@STSSystems.com said:

>Why does the following not work for me?
>
>format NAME =
>TEST
>----
>@<<<<<<<<<<<<<<<
>$test
>..
> 
>$test = "asdfjkl;";
> 
>select(NAME);
>write();

That tries writing to the filehandle NAME, too.  Instead of select(NAME),
do:

  $~ = "NAME";

That will set STDOUT's default format name to "NAME".

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About