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

Re: [FWP] Perl Card Games



On Tue, Aug 03, 1999 at 05:21:26PM -0400, Amir Karger wrote:
> On Tue, Aug 03, 1999 at 01:43:48PM -0700, Eli Evans wrote:
> > 
> > Further, not that I'm recommending it (in light of the docs, not because
> > it's not fun), but
> > 
> >     perl -e "print join ' ', sort {$a <=> (int rand 50)} (1..50)";
> > 
> > does exactly what one might expect. For me, anyway. (5.005_02 built for
> > MSWin32-x86-object.)
> 
> Interesting. 5.004 on linux yields:
> 
> fermi2:~>perl -e "print join ' ', sort {$a <=> (int rand 50)} (1..50)"
> a: Undefined variable.

That's an error from the shell, not from Perl.  Your shell, being on a Unix
system, interpolates variables on the command line within double quotes.
Use single quotes around the script, and double quotes within.

Eli's shell, on the other hand, being on a Windows system, does weird
things when single quotes are used around an argument (in fact, I think it
ignores them), which is why he used double quotes on the outside and single
quotes within.

Something to keep in mind when using -e on Unix and Windows.


Ronald

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