in reply to sprintf vs formline

You probably should localize $^A:

sub foo { local $^A; my @lines = @_; my $printIt = "+-----------------------+\n"; foreach $line (@lines){ formline("| \@|||||||||||||||||||| |\n",$line); } $printIt .= $^A; $printIt .= "+-----------------------+\n"; return $printIt; }

See perlvar for more details.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: sprintf vs formline
by nmerriweather (Friar) on Sep 03, 2002 at 04:09 UTC
    that works well!

    I tried using 'my' earlier -- just because i'm in the habit of my vs local -- but that triggered an error

    never thought of trying local instead -- figured it would just spew an error as well.

    obviously, it didn't

      Local is used for "hiding" the current value of a package level (dynamic variable) for the duration of a scoped block. Note that duration means temporal and not the spatial aspect of a scoped block.

      (Well actually you can localize array indexes and hash entries in lexicals too, but people dont do this often.)

      Yves / DeMerphq
      ---
      Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)