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