Hai all.
I want to make a script which converts like (pErl1234test = perl).I wrote like
#!/usr/bin/perl print "Enter ur name" $name = <STDIN> $org_name = $name $name =~ s/\W.*//; #change 1 $name =~ tr/A-Z/a-z/; #change 2 print "Old = $org_name\n"; print "New = $name\n";
But i can not get a change on the change 1 and 2 lines.
The problem with 'change 1' is that word characters (\w) _include_ digits where you seem to expect that they don't, so I use a character class to produce the results that you /seem/ to want.
#!/usr/bin/perl
use strict; use warnings;
print 'Enter your name: '; my $new_name = <STDIN>; chomp($new_name); my $old_name = $new_name;
$new_name =~ s/[\W\d].*$//; #change 1 $new_name =~ tr/A-Z/a-z/; #change 2
print "Old = $old_name\n"; print "New = $new_name\n";
__END__
Regards, Randy.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>