[VPM] Printing one line over several lines

Carl B. Constantine cconstan at csc.UVic.CA
Thu Mar 27 13:58:48 CST 2003


*On Thu Mar 27, 2003 at 11:50:58AM -0800, Peter Scott (Peter at PSDT.com) wrote:
> >> my @split_names = map split_name($_), @allPrinters;
> >
> >interestingly, I get an error on the above line even though I put this
> >section of the code in a new routine to test it out:
> >
> >Global symbol "@split_names" requires explicit package name at
> >resPrint.pl line 617
> >
> >but, I/you used "my @split_names" so what is it complaining about a
> >global for? Nothing like that exists anywhere else in my code.
> 
> Probably a syntax error on an immediately preceding line.

nope. I put this code at the end of the file in a new subroutine like
so:

sub newHeader {
 my @split_names = map split_name($_), @allPrinters;
 for (my $line = 0; grep $split_names[$_][$line] => 0..$#allPrinters; $line++) {
    my $begin = $line ? "              " : "Student Login ";
    print $begin, map(col_fmt($_, $line, $split_names[$line]) => 0 .. $#allPrinters), "\n";
  }
}

So I shouldn't get any such error;

I just moved it to "global" scope and do not get any errors, but I also
do not get printer names either. Having it in both locations gives me an
error on max:

Undefined subroutine &main::max called at ./resPrint.pl line 618.

-- 
Carl B. Constantine         University of Victoria
Programmer Analyst          http://www.csc.uvic.ca
UNIX System Administrator   Victoria, BC, Canada
cconstan at csc.uvic.ca        ELW A220, 721-8753



More information about the Victoria-pm mailing list