Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re3: Words without a Dictionary

by dragonchild (Archbishop)
on Jul 22, 2003 at 19:37 UTC ( [id://276894]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Words without a Dictionary
in thread Words without a Dictionary

You are being thick. $word is a variable that's scoped to the generate_password() subroutine. Of course, you can't print it out. Try printing the value returned by calling the subroutine, as seen below:
#!/usr/bin/perl { my @words = qw( perl monk vroom ); my %convert = ( i => '!', e => '#', s => '%', o => ')', ); sub generate_password { my $word = $words[rand @words] . $words[rand @words]; $word =~ s/(.)/$convert{$1} || $1/eg; $word; } } print generate_password(), $/;

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://276894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found