On Fri, Dec 20, 2013 at 11:05:46AM -0500, Lance A. Brown wrote: > On 2013-12-20 10:45 am, Brandon Allbery wrote: > >Actually Switch is considered rather bad. > > > >>#Okay lets setup the school variable > >>#For sanity lets make sure we got the correct variable from the > >>script > >>print "$ARGV[0]n"; #this prints the correct variable > >>if ($ARGV[0] == "rc") {$school = "rc"} #This line is the only line > >>evaluated. I always get this value > >> elsif ($ARGV[0] == "bp") {$school = "bp";} > > > >(...) > > > >This looks rather a lot like `$school = $ARGV[0];` or maybe `$school = > >shift;`. > > This! Very much this. > > if all those comparisons are of the form: > > if $ARGV[0] == "X") {$school = "X";} > > and none of them do > > if $ARGV[0] == "X") {$school = "Y";} > > then just assign > > $school = $ARGV[0] > > No need for that big ugly "switch" statement.
Although you might want to put in a big ugly regexp for validation purposes. -dsr- _______________________________________________ Tech mailing list Tech@lists.lopsa.org https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech This list provided by the League of Professional System Administrators http://lopsa.org/