in reply to If statement issue from a Noob
Hi, in plain human language you are saying "free batteries only with orders worth $55 or more for non-electric items".
So say that in Perl:
use strict; use warnings; ... open my $OUT, '>', $filename or die $!; print $OUT "free_batteries" if $price >= 55 and $title !~ /electric/; print $OUT "\n"; # in all cases
Update: Changed to use postfix conditional to avoid any debate over brackets, braces or indentation ;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: If statement issue from a Noob
by holli (Abbot) on Oct 04, 2017 at 18:59 UTC | |
by 1nickt (Canon) on Oct 04, 2017 at 20:01 UTC | |
by holli (Abbot) on Oct 04, 2017 at 20:36 UTC |