That speeds up parameter passing by removing the need to make a copy.
That's only part of the story. It's also, even most of all, the way HTML::TokeParser distinguishes between literal HTML in a string, and a string holding the file name of a file containing the HTML:
Note cases 1 and 2.$p = HTML::TokeParser->new( $filename ); $p = HTML::TokeParser->new( $filehandle ); $p = HTML::TokeParser->new( \$document );
Choosing this convention instead of the other way around, was indeed the wisest choice with regard to efficiency.
In reply to Re^2: Why do you need to escape a string used as a paramater?
by bart
in thread Why do you need to escape a string used as a paramater?
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |