You've got a bit of a mish-mosh here.

Command line arguments are passed in the array @ARGV, not the scalar $ARGV. It doesn't matter whether you use it before or after "use DBI", so if the behavior of your program changes when you do that, you must be making some other change as well, but I can't tell what without looking at the (Perl) code.

Finally, that error message is from your program, not bash; if bash tried to open a file and couldn't, it would only say: data2: No such file or directory Somewhere in your code, you must be saying something along the lines of open X, $filename or die "Can't open $filename: $!"; So the next question: does the file data2 exist??

So.... To answer your question "How do you pass strings as command line parameters?": they're passed in @ARGV; see, for example, man perlrun.

To answer your question, "What am i doing wrong?": It's not clear, maybe several things. Code snippet would help.

HTH


In reply to Re: Command line args by VSarkiss
in thread Command line args by iamcal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.