Perl Switch/Case Satement

for (@ARGV) { if (/^6\d{4}$/)…

Login

Blog History



for (@ARGV) {
        if (/^6\d{4}$/)  { $item_code = $_; $action = 'load'; } 
        elsif (/^stop$/) { $action = 'stop' ; } 
        elsif (/^start$/) { $action = 'start'; }
        else { print "Default\n"; }    
}

print "Item : " . $item_code . "\n";
print "Action : " . $action . "\n";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.