use strict; use warnings; ##################################### sub hexdump { return ( '00000000: 33 33 33 33 33 33 33 33 33333333' . "\n" ); } ##################################### my $fh = *STDOUT;
print '' . & hexdump (); print & hexdump (); print $fh '' . & hexdump (); print $fh & hexdump (); __END__
Sample output:
>test.pl 00000000: 33 33 33 33 33 33 33 33 33333333 00000000: 33 33 33 33 33 33 33 33 33333333 00000000: 33 33 33 33 33 33 33 33 33333333 00?? ?? >
Why is the fourth line different, and where is it documented that it should be different?
'&' can be interpreted as the bitwise and operator, and in your 4th line it is. The file handle $fh is being bitwise anded with the result of the function call to hexdump(). Either omit the & (you don't need it anyway), or put parenthesis around the function call to disambiguate:
print $fh (& hexdump ());
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs