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

Re: [FWP] YAGOLF: password generation



On Wed, Apr 11, 2001 at 01:58:00PM -0300, Joey Mitchell Comeau wrote:
> 
> > >   perl -pe'$\.=chr(33+rand 93)for 0..7'
> 
> >     perl -pe'map$\.=chr 33+rand 93,0..7'
> 
> I'm having trouble with both of these actually. They work fine in a
> script, but from the command line I have to hit enter. I don't think I
> understand exactly what -p does.
> 
>  perl -e'map$\.=chr 33+rand 93,0..7;print'
> 
> 	works fine. But the above, which I thought was equivalent, does
> not. Can anybody shed any light on what I am doing wrong?
> 

-p causes Perl to put a loop around your script:


LINE: while (defined($_ = <ARGV>)) {
    # your script
}
continue {
    print $_;
}


So, the first two snippets above cause Perl to wait for input before
executing the main part of the code.


Ronald

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