Re: interpoliation within regexp
- From: derekbellnersmith@xxxxxxxxx (Derek B. Smith)
- Date: Thu, 28 Sep 2006 12:52:46 -0700 (PDT)
--- "Mumia W." <mumia.w.18.spam+nospam@xxxxxxxxxxxxx>
wrote:
On 09/28/2006 12:04 PM, Derek B. Smith wrote:
******************************************that
The input data is a 6 character randomized string
could start with a # such as 6FhJ9Z. If it doesstart
with a number then I need to convert thischaracter
into its cooresponding alpha char, [a-z,A-Z].there
The output data from the string 6FhJ9Z should be
[a-z,A-Z]FhJ9Z I guess what I am asking for is not
plausible after looking at the ASCII table b/c
is no cooresponding letter for number 6. Silly me,ok
then maybe grab any [a-z,A-Z] character.
my $foo = pack("C*", 6); print $foo;
or
chr ('6');
What is the purpose of this program?
To generate a random 6 character string.
If the first character starts with a # then I just
ignore the new string and tell it to goto LABLE, b/c
for 0-32 on the ASCII table cannot be used as a 1st
character in a user password.
## generate random 8 char password.
PASSWD: my @a = ( 0 .. 9, 'a' .. 'z', 'A' .. 'Z');
my $password = join '', map { $a[int rand @a] } 0 ..
5;
#if first char is a-z then print it else warn
#chop string into individual characters
my @chars = unpack ("A1" x length($password),
$password);
if ($chars[0] =~ /^\D/) {
print "Your new password is:\t",@chars,"\n";
}
else {
#print "string starts with number:\t",@chars,
"\trestarting\n";
#substr($chars[0],0,1) =~ s/$chars[0]/chr ($1)/e);
## execute with regexp substitute ?/?
goto PASSWD;
}
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
.
- Follow-Ups:
- Re: interpoliation within regexp
- From: John W. Krahn
- Re: interpoliation within regexp
- References:
- Re: interpoliation within regexp
- From: Mumia W.
- Re: interpoliation within regexp
- Prev by Date: Re: hash slices
- Next by Date: Hash problem
- Previous by thread: Re: interpoliation within regexp
- Next by thread: Re: interpoliation within regexp
- Index(es):
Relevant Pages
|
|