in reply to Re: print to data
in thread print to data

i dont quite understand the custom print routine you just described above. can you explain in a little bit more detail please. thanks.

Replies are listed 'Best First'.
Re^3: print to data
by shmem (Chancellor) on Sep 06, 2006 at 14:12 UTC
    sub cprint { $capture ? (print @_) : push(@output,@_); }

    is short for

    sub cprint { if($capture) { # if $capture is != 0, '' or undef print @_; # print what's passed in } else { # otherwise push(@output,@_); # stuff goes into @output } }

    See the section Conditional Operator in perlop for $foo ? $bar : $quux.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}