Skip to content

Instantly share code, notes, and snippets.

@AndrewRussellHayes
Last active December 28, 2015 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewRussellHayes/7566311 to your computer and use it in GitHub Desktop.
Save AndrewRussellHayes/7566311 to your computer and use it in GitHub Desktop.
Code to get the value of a switch (in this case the switch is a single line file with a boolean value on it)
my $switchName = "Debug Switch";
open($switchFileHandle,'<',$switchFile) || warn "cant open switch file $!";
$switch = <$switchFileHandle>;
close($switchFileHandle);
chomp($switch);
if($switch){$switch = "ON";}
else{$switch = "OFF";}
$switchString = "$switchName($switch)";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment