fork download
  1. #!/usr/bin/perl
  2. # your code goes here
  3.  
  4. sub main {
  5. my $text = "The code for this device is GP8765.";
  6.  
  7. if($text =~ /(\w\w\d{2,6})/){
  8. print "The code is: '$1'";
  9. }
  10. else{
  11. print "Code not found";
  12. }
  13. }
  14.  
  15. main();
Success #stdin #stdout 0s 17488KB
stdin
Standard input is empty
stdout
The code is: 'GP8765'