work around perl error
some versions of perl failed to run packet.pl because the 'last' keyword can't be used outside of a loop block. this commit changes the packet dumping code to a function so we can use 'return' instead.
some versions of perl failed to run packet.pl because the 'last' keyword can't be used outside of a loop block. this commit changes the packet dumping code to a function so we can use 'return' instead.