in reply to Check for hash ref emptiness
Instead of checking for 'empty', you should be checking 'defined-ness' - which , for a hash uses 'exists':
UPDATE: Added 'defined' check, per comment by AnomalousMonk(++), below.if ( exists $data->{classes} and defined $data->{classes} ){ $data->{classes} =~ s/XY//g; }
Python is a racist language what with it's dependence on white space!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Check for hash ref emptiness
by AnomalousMonk (Archbishop) on Feb 07, 2018 at 22:49 UTC |