$tempdesc = $hashref->{price};
$tempdesc2 = $hashref->{title};
if ($tempdesc >= 55 && $tempdesc2 !~ /electric/)
{
print FH_OUTFILE "free_batteries";
}
print FH_OUTFILE "\n";
####
if ($tempdesc >= 55 && $tempdesc2 !~ /electric/)
{
print FH_OUTFILE "free_batteries\n";
print FH_OUTFILE "something else\n";
print "A message displayed on the screen if the condition is satisfied\n";
}
print FH_OUTFILE "\n";
####
use strict;
use warnings;
# here the code where the $hashref is populated (or maybe it is actually part of a hash of hashes or array of hashes, we don't know enough details)
open my $FH_OUTFILE, ">", "output.txt" of die "could not open the output file $!";
my $price = $hashref->{price};
my $item_name = $hashref->{title};
if ($price >= 55 and $item_name !~ /electric/)
{
print $FH_OUTFILE "free_batteries";
}
print $FH_OUTFILE "\n";
# perhaps some code to close $FH_OUTFILE (if you're done at this point)