Perl Switch/Case Satement

Written by James McDonald

November 24, 2011



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 *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...