If the error message you've quoted is all that you're seeing ("tshark: An error occurred while printing packets: Invalid argument"), that strikes me as really poor error reporting by the tshark author(s). You should follow
BrowserUK's advice, and when you see the contents of $tsharkcmd as printed by your script, you should copy/paste that string onto the command line to run it manually and see if you get the same error message.
I looked up the tshark man page, and it seems like your command-line string should be ok, unless (a) as suggested by NetWallah, you forgot to provide an input file name when you ran your script, or (b) you've provided an input file name that doesn't exist (or couldn't be found by tshark, because you didn't provide the correct path as part of the file name), or (c) any of the 15 strings you're using as values for "-e" options happens to be incorrect.
As for your two "open" statements, did you leave out some lines of code in what you've posted? If not, then your script isn't really finishing the job: you need to read from the TSHARK file handle, and write to the OUT file handle, but there's nothing in the OP code to do that.
Actually, you don't need to use file handles at all; just append " > $output" at the end of the command-line string, and do:
system( $tsharkcmd );
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.