Use || for assigning to a variable:
$a = $b || $c
Use "or" to control program flow:
$a = $b or die 'error: $b is unexpectedly false'
Mnemonic: || is a symbol like variables and numbers are, while "or" and "die" are both english words.
(source, source)
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Showing posts with label control. Show all posts
Showing posts with label control. Show all posts
Perl: Disable control-C and control-Z
$SIG{'INT'} = 'IGNORE'; # Ctrl-C
$SIG{'TSTP'} = 'IGNORE'; # Ctrl-Z
$SIG{'TSTP'} = 'IGNORE'; # Ctrl-Z
Labels:
control,
keys,
live,
perl,
production
Subscribe to:
Posts (Atom)