[25850] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8085 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 16 14:05:27 2005

Date: Mon, 16 May 2005 11:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 16 May 2005     Volume: 10 Number: 8085

Today's topics:
    Re: format (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 16 May 2005 08:21:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: format
Message-Id: <d69l5p$6i7$1@mamenchi.zrz.TU-Berlin.DE>

James <J_dog69@yahoo.com> wrote in comp.lang.perl.misc:

> if i have an array how can i print all element in the array in a format
> block when i don't know the length of the array until run time?

You set $num and name to their successive values and call "write".  Have
you read "perldoc -f format" and "perldoc perlform"?  It doesn't look like
you did.

> by format block i mean

No, you don't.

> format = STDOUT
> number = @#####
>                 $num
> name = @<<<<<<<<<
>              $name
> .
> that sort of thing.

That sort of thing is a syntax error.  The "=" in the format-line is
misplaced.  Please don't re-type code, copy/paste it.

    my @names = qw( John Mary Edward Jane);

    my ( $num, $name) = 0;
    for $name ( @names ) { write }

    format STDOUT =
    number = @#####
    ++ $num
    name = @<<<<<<<<<
    $name
    .

Anno


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8085
***************************************


home help back first fref pref prev next nref lref last post