Annihilannic
MIS
Hi,
Could someone please explain why the ^ in the second below expression doesn't do as I would expect?
[tt]$ echo hereditary | perl -n -e 'y/[e]//d;print'
hrditary
$ echo hereditary | perl -n -e 'y/[^e]//d;print'
hrditary
$[/tt]
I would expect it to delete all characters except "e" from the input in the second example.
I have a workaround (below), but would like to understand why the above isn't working.
[tt]$ echo hereditary | perl -n -e 's/[^e]//g;print;print "\n"'
ee
$[/tt]
Any wisdom gratefully received...
Annihilannic.
Could someone please explain why the ^ in the second below expression doesn't do as I would expect?
[tt]$ echo hereditary | perl -n -e 'y/[e]//d;print'
hrditary
$ echo hereditary | perl -n -e 'y/[^e]//d;print'
hrditary
$[/tt]
I would expect it to delete all characters except "e" from the input in the second example.
I have a workaround (below), but would like to understand why the above isn't working.
[tt]$ echo hereditary | perl -n -e 's/[^e]//g;print;print "\n"'
ee
$[/tt]
Any wisdom gratefully received...
Annihilannic.