Advertisement
digimer

Untitled

Aug 15th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.67 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. print "\nInput the number:";
  7. chomp ( my $num1 = <STDIN> );
  8. print "Input the name:";
  9. chomp ( my $name1 = <STDIN> );
  10.  
  11. print "num1: [$num1], name1: [$name1]\n";
  12.  
  13. if ((defined $num1) && (defined $name1))
  14. {      
  15.         print "The answer is: ";
  16.         for (0..$num1)
  17.         {
  18.                 print "$name1";
  19.         }
  20.         print "\n";
  21. }
  22. else
  23. {
  24.         print "One of your inputs was undefined!\n";
  25. }
  26.  
  27. =pod
  28.  
  29.   0 root@lemass:/home/digimer# /tmp/foo
  30.  
  31. Input the number:8
  32. Input the name:digimer
  33. num1: [8], name1: [digimer]
  34. The answer is: digimerdigimerdigimerdigimerdigimerdigimerdigimerdigimerdigimer
  35.  
  36. =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement