Re: NEw to Perl

From: Tad McClellan (tadmc_at_augustmail.com)
Date: 09/03/04


Date: Thu, 2 Sep 2004 23:52:05 -0500

Shawn Melnic <sham_x30@yahoo.com> wrote:

> while(&list) {
> @line = ..
> bla bla
> bla
> }
>
> sub list {

     my @list;
     push @list, "line 1";
     push @list, "line 2" ;
     push @list, "line 3" ;
     return @list;

> }
>
> Basically, I want while to read the sub list into an array..

Can't be done.

But you can have the sub return a list, as above.

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


Relevant Pages

  • Re: VB-101: Passing Arrays ByVal vs ByRef
    ... won't change the reference of the variable being passed to the method'. ... If the parameter is passed 'ByVal', the array passed to the method in the parameter is not changed, because you are assigning the new array to a temporary copy of the array pointer passed to the method. ... Public Sub Foo1(ByVal Bla() As Integer) ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Printing After A While Loop
    ... Bla wrote: ... >>I quoted you fully only because I cannot for the life of me figure out ... Fort Worth, Texas ...
    (comp.lang.perl.misc)
  • Re: Large Matrix Handling Issue 64 bit
    ... why 8GB is the practical limit to array size. ... the available largest memory chunk. ... bla, bla, ...
    (comp.soft-sys.matlab)
  • Re: Newbie-Question: Function-Parameters
    ... > What is the most common way to pass an array into a function - and how ... By pointer, which is even simpler than you may think. ... void foobar(int bla[]) ... void foobar(int* bla) ...
    (comp.lang.c)
  • Re: Perl and vmstat
    ... >> Why do you want to save that to an array? ... There must be *some* reason why you thought that that was useful... ... >> Fort Worth, Texas ...
    (comp.lang.perl.misc)