Hello,
I am building a primary key for a database, and I guess the first question would be
how safe is a key made from the last 4 digits of a social security num and the first
3 letters of the last name. Now for the PERL question, I have substr. line working
correctly.
I wanted to try it with ReGrex, but the syntax is escaping me.
Any pointers would appreciated!
Thanks,
Dave
( webmaster @ www.coraconnection.com / Ft. Worth, TX, USA)
#!/usr/bin/perl -w
#use strict;
$ss = '1234567890';
$lname = 'Gilden';
# $pkey = substr($ss,length($ss)-4,length($ss)) . substr($lname,0,3);
# print "$pkey\n";
$ss = '09876543';
$lname = 'Smith';
# this line is bad! -- trying to have the same functionality as the substr line.
$pkey = ($ss =~ m/\d{length($ss)-4}($ss{length($ss)})/);
# $pkey = ($pkey =~ m/$lname{0,3}/;)
print "$pkey\n";
# Is there any advantage using =~ m/(\w){3}/ over substr method?
__END__
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>