[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] From the Perl Conference 3.0 Perl quiz (2)



On Wed, Aug 25, 1999 at 05:40:46PM -0700, Derek J. Balling wrote:
> At 08:27 PM 8/25/99 -0400, Keith Calvert Ivey wrote:
> >Prakash Kailasa <PrakashK@bigfoot.com> wrote:
> >
> > > Spoiler ---
> > >           |
> > >           v
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > It prints 1.
> > >
> > >     use constant e => 2, pi => 3;
> > >
> > > This really creates a list constant (2, 'pi', 3);
> > >
> > >     print e ** pi;
> > >
> > > is really,
> > >
> > >     print '2pi3' ** 'pi'
> >
> >Not quite.  You mean
> >
> >       print ((2, 'pi', 3) ** 'pi');
> 
> No, actually, he's right... try doing:
> 
> print e;
> 
> He's correct. :)  Orwant was wrong (he said it would contain "2") but it 
> really contains "2pi3"
> 

HINT: A sequence of comma-seperated values in scalar context does _not_
evaluate to a string concatenation of all the values.

print scalar(e);

Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe