in reply to Perl 5.10.1 - compare external program output with a list of known error codes
Also, when matching against a regex, don't include double quotes in it, as they are interpreted literally, but your strings don't contain them. The slashes are already the delimiters, no need for anything else.
You can use the | alternative operator inside a regex:
#!/usr/bin/perl -- use warnings; use strict; use feature qw{ say }; while (<DATA>) { if (/no private key could be found for decryption|signing key not +found|no keys found/) { say 'Missing key(s)'; } elsif (/file not found/) { say 'File not found' } else { say 'Unknown error'; } } __DATA__ 3001:input file not found 1080:no private key could be found for decryption 1053:signing key not found 3013:no keys found 3011:invalid passphrase specified 3011:invalid passphrase specified 3090:operation failed, file not found 3028:multiple inputs cannot be sent to a single output file
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl 5.10.1 - compare external program output with a list of known error codes
by malokam (Novice) on Sep 19, 2016 at 19:08 UTC | |
by stevieb (Canon) on Sep 19, 2016 at 19:20 UTC | |
by malokam (Novice) on Sep 19, 2016 at 19:46 UTC |