I really miss use strict; use warnings in my Perl one-liners such as:perl -ne 'print unless /[0-5],[0-5]?|hernia|.{170,}|benz/' file`especially when I include many conditions separated by |.I have noticed that the filtering becomes more and more unstable when you have more conditions. Examples of data missed or where the command works unstably123.Symptoms of hernia are all, except: | happy | energetic | sleeping | down regulation of CNS hello | running 5Signshello of mercedes benz car model: | Big tyres | Even bigger roller | Massive emergency of try | Hello world | All from above 1where two entries where the regex works unstably. How can you use strict and warnings in Perl one-liners? How can you design such long conditional statements better?
To have strict and warnings in Perl oneliner
perl;testing
If you want strict and warnings, the answer is 'don't do a one liner'. Almost invariably one liners suffer from perl's propensity for write-only code. Expand it out into a multi-liner instead. If you really want - you can embed it using a HEREDOC perl <<ENDPERL use strict; use warnings; print This is a test\n; ENDPERLOr alternatively:perl -Mstrict -Mwarnings -e 'print something'But really - this won't help you debug that regular expression, since it's quite unlikely that the RE is going to be triggering warnings. For longer conditionals, I go for the expedient route - write it down, that way you don't have to worry about missing something out the next time you use it. Your example looks like a 'simple' grep -v type construct:#!/usr/bin/perluse strict;use warnings;my @patterns_to_skip = ( hernia,                           ignshello, );my $regex = join ( |, map { quotemeta } @patterns_to_skip );$regex = qr/$regex/;while ( <> ) {   print unless m/$regex/;}