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…

Toggen builds a new website

So I have built and hosted a new website for Roger Clark Pest Management they are a family owned and operated Pest...

WizTree

Just downloaded WizTree (not a sponsor) from https://wiztreefree.com/ It seems to do what it says on the tin which is...

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...