On Mar 29, MuthuKumar said:

>        I want to make a script which converts like (pErl1234test = perl).I

>        #!/usr/bin/perl
>        print "Enter ur name"
>        $name = <STDIN>
>        $org_name = $name

Those three lines are all missing semicolons.

>        $name =~ s/\W.*//;      #change 1
>        $name =~ tr/A-Z/a-z/;  #change  2

Those should work, but I'd use lc() instead of tr/A-Z/a-z/.

>        print "Old = $org_name\n";
>        print "New = $name\n";

  #!/usr/bin/perl -w

  use strict;  # look into this -- it enforces safer coding practices

  print "Enter your name: ";
  chomp(my $name = <STDIN>);  # chomp removes the ending newline
  my $old_name = $name;

  $name =~ s/\W.*//;
  $name = lc $name;

  print "Old = $old_name\n";
  print "New = $name\n";

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to