Although it should probably work in this case, I would advise you against using the same name for different types of things:
my $infile = $ARGV[0]; infile ($infile); sub infile { open( my $infile, '<', $ARGV[0] ) or die "cannot open file: $!"; # ...
The name infile is used for three different types of things: a file name in the first line above, a function name in the second line, and a file handle at the last one. This is at best very confusing for yourself. You could rewrite this as follows:
my $infile = $ARGV[0]; process_file ($infile); sub process_file { my $current_file = shift; # or: my $current_file = $_[0]; open my $FILEHANDLE, '<', $current_file or die "cannot open file +$current_file: $!"; # ...
At least there is no danger of mixing up the various entities. Actually, although the $infile name is perfectly acceptable, it might be even better to have a name reflecting the content of the file, such as, for example $resources_infile or $employees_infile, whatever you have in the file, or even simply $resources or $employees. We can see from your code that you are going to open it as a file, but have no idea of the contents. Also naming the file that you cannot open in the message passed to die can be useful when you have to open several files and something goes wrong.

In reply to Re: sending data thru a sub routine by Laurent_R
in thread sending data thru a sub routine by james28909

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.