Hello choroba,
Nice solution, especially the inclusion of last which avoids a potentially nasty bug.
But as it stands, this code will match a filter value such as ac* with an input value such as zac1234 — which doesn’t appear to be what the OP wants. This is easily fixed by anchoring the filter regex to the beginning of the match:
$value = $filter->[1], last if $key =~ /^$filter->[0]/;
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^2: Grep asterisk sign in input file
by Athanasius
in thread Grep asterisk sign in input file
by DespacitoPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |