my $fmt = q[ x[10] a5 # code x[22] a10 # thingummy x[4] a3 a2 # doodah & whatsit ]; $fmt =~ s/#.*//g;
But pack allows for comments in patterns, so one doesn't even need that last line.
Update: Originally, the /g was missing, which led me to discover that one doesn't need to remove the comments.
In reply to Re^2: Unpack Many Fields
by ikegami
in thread Unpack Many Fields
by shoness
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |