You need to change the format of your command line. Because the ">" is not inside quotes it will be interpreted by the shell, redirecting the output of the command to a file named value_2. This happens before your script gets control. You might try changing the command line to
-c:'field_1=value_1','field_2>value_2'
Update: after looking at Getopts::Long again, it needs to be more like this, with repeated -c options:
-c 'field_1=value_1' -c 'field_2>value_2'
This can be parsed with
use Getopt::Long;
our @opt_c;
GetOptions("c=s@");
print join ", ", @opt_c;
but you will still need to break out the field names and values from each element of the array @opt_c with a regex, something like
/^(.*?)([<=>])(.*)/
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.