崬城衞 发表于 2018-8-31 09:48:24

Perl Learning - 7 (strict/warnings, return a list, & usage)

4. Write a sub greet(), use the given name as argument, print the welcome words and tell him the name who came before him.  greet ("Fred");
  greet ("Barney");
  should print:
  Hi Fred! You are the first one here!
  Hi Barney! Fred is also here!
  #!/usr/bin/perl
  sub greet{
  chomp(my $name=$_);
  push @names,$name;
  while($index
页: [1]
查看完整版本: Perl Learning - 7 (strict/warnings, return a list, & usage)