Lance, The perl script is called like this from another shell script that does some worlk
perl weekdays.pl $school Then in the perl script I am trying to print a long named based on the value of $school which ends up as $ARGV[0] in my perl script. What is giving me grief is that some of these titles contain single quotes. So I was trying to handle the single quote PITA in my PERL script. So in my shell script I find out which server I am running the script (That set of code works great for all of my scripts) so I set the variable to the Server's Long Name. When the name has a single quote I don't get the entire variable. The shell will break up the variable so "Cardinal O'Hara" gets broke up when it gets passed to the PERL script as Cardinal. So in my shell script I set the variable for that server to "\"Cardinal O'Hara\"" and the variable gets created as "Cardinal \O'Hara" but in the perl script that becomes "Cardinal The O'Hara part gets split at the space or somewhere. I need that single quote as the people that read the report get testy. I figure I might just do it some other way as this is getting to a big time PITA for a stupid single quote. On Fri, Dec 20, 2013 at 11:05 AM, Lance A. Brown <la...@bearcircle.net>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. > > --[Lance] > > > _______________________________________________ > 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/ > -- John J. Boris, Sr. Online Services www.onlinesvc.com
_______________________________________________ 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/