I know absolutely nothing about Perl (I don't know much about computers in general). However, I was just handed a .pl file and told I could modify it to make it work for me. I'm sure this answer is easy, but I'm not even sure of the right lingo to find the answer. The file starts with:

print "Enter base name of input files\n"; chomp ($basename = <STDIN>);

I understand that this just prompts me for a variable name. If I replace  <STDIN> with  'filename', it uses the file appropriately. My question is, can I start this .pl file and pass this variable at the same time without having to go in and edit the .pl file each time? I'd expect something like:

 ./file.pl $basename='filename'

It would be even easier if I could just execute this with:

 ./file.pl filename

I'm trying to submit a bunch of files to be run batch on a parallel cluster, and I'm sick of having to go in and change every file name in the .pl file. Any words of wisdom? Again, take it easy on me. I've searched around and can't find the exact answer.


In reply to adding a variable definition to execution by roberree

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.