The code in the SYNOPSIS is "broken" with regard that this:
open $fh, '<', 'device_behav.vhd' || die $!
Will *not* die on open() errors. You need to use 'or' instead of '||'
or put parentheses around open()'s args:
open($fh, '<', 'device_behav.vhd') || die $!
|| and 'or' have different precendence and the way you got it here it
parses as: open $fh, '<', ( 'device_behav.vhd' || die $! ); thus never
dies and never checks for open errors.
Thanks,
Zoffix Znet