fork download
  1. use strict;
  2. use warnings;
  3.  
  4. my @cases = qw(TF=22; BT=22; =220;);
  5. for my $str (@cases) {
  6. my @matches = $str =~ /^TF=(\d{1,2});$/;
  7. if (@matches) {
  8. print "Got it: $str -> $matches[0]\n";
  9. } else {
  10. print "Nothing to do with: $str\n";
  11. }
  12. }
Success #stdin #stdout 0s 4728KB
stdin
Standard input is empty
stdout
Got it: TF=22; -> 22
Nothing to do with: BT=22;
Nothing to do with: =220;