In a message dated 6/17/2004 5:32:16 PM Eastern Standard Time, [EMAIL PROTECTED] writes: >I knew about that but the problem is most of the users (incuding myself >;p) will want to print it without the same $header info twice and don't >want to have a bunch of print scalar whatevr(); > >If there is no way to tell if fooyou() was called in 'print context' >then we'll just use scalar, but I was hoping there was a way to tell... > >like this would be super nice if such a beast as wantprint existed... > >return "$header$data1$data2" if wantprint; >return ("$header$data1","$header$data2") if wantarray; >return "$header$data1$data2";
There is no such thing as print context. As it says in perlfunc "Because print takes a LIST, anything in the LIST is evaluated in list context, and any subroutine that you call will have one or more of its expressions evaluated in list context." -will http://www.wgunther.tk (the above message is double rot13 encoded for security reasons) Most Useful Perl Modules -strict -warnings -Devel::DProf -Benchmark -B::Deparse -Data::Dumper -Clone -Perl::Tidy -Beautifier -DBD::SQLite -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>