fork download
  1. #!/usr/bin/perl
  2. # "Music Live"
  3. my $str = "12 hr 60 min";
  4. my @str1 = split (/\s/, $str);
  5. if($str1[1] eq "hr" and $str1[3] eq "min")
  6. {
  7. print "correct";
  8. my @st=split(/\s+/,$str);
  9. if($st[0]>12 or $st[1]>60 or $st[2]>60)
  10. {
  11. print "wrong";
  12. }
  13. else
  14. {
  15. print "\n First ".$st[0];
  16. print "\n Second ".@st[1];
  17. print "\n Third ".@st[2];
  18. print "\n Fourth ".@st[3];
  19. print "\n str: ".$str."\n";
  20. }
  21. }
  22. else
  23. {
  24. print "wrong";
  25. }
  26.  
Success #stdin #stdout 0s 4596KB
stdin
Standard input is empty
stdout
correct
 First 12
 Second hr
 Third 60
 Fourth min
 str: 12 hr 60 min