Got it.  Thanks.

--- "Charles K. Clarkson" <[EMAIL PROTECTED]>
wrote:
> Stuart White <[EMAIL PROTECTED]> wrote:
> :
> : > sub anchor($$);
> : >
> : > print anchor( '/perl/', 'Learning Perl' ); #
> works
> : > print anchor( foo() );                     #
> fails
> : >
> : > sub anchor($$) {
> : >     my( $href, $name ) = @_;
> : >     return qq(<a href="$href">$name</a>);
> : > }
> : >
> : > sub foo() {
> : >     return( '/perl/', 'Learning Perl' );
> : > }
> :
> : I stared at this code for about 10 minutes before
> I
> : understood what was going on, why one failed and
> one
> : worked... my response to that would be, of course!
> : You're passing literals, not scalars to anchor(),
> 
>     This is perl. Literals are scalars.
> 
> 
> : but you're prototyping anchor() to receive
> literals.
> 
>     No. I'm prototyping anchor() to receive two
> scalar
> values. Numbers, strings, and references are all
> valid
> scalars in perl. Perl prototyping does not
> distinguish
> between variables and literals.
> 
> 
> : See, if I saw some code where anchor() was used
> : twice, once where it received scalars, and another
> : when it received literals or hashes, or arrays,
> I'd
> : be so confused.
> 
>     That's a problem when thinking in one language
> while programming in another. Sometimes you have to
> forget the C you know.
> 
> 
> : I never saw the benefit of passing literals, which
> : might explain it.
> 
>     As for as perl prototyping is concerned literals
> and scalar variables are interchangeable. Perl is
> not
> a subset of C. It is a whole new adventure.
> 
> 
> HTH,
> 
> Charles K. Clarkson
> -- 
> Mobile Homes Specialist
> 254 968-8328
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to