in reply to Re: A regex question.
in thread A regex question.

This won't work because you are opening the filehandle only for writing. In fact it will clobber the contents of the file.

It should be:

# open FILE, ">filename.txt" or die $!; #output only, and deprecated s +yntax open my $file, '<', 'filename.txt' or die $!; while (my $ethernet = <$file>) { ## do something }
The way forward always starts with a minimal test.