Your subroutine never inserts anything into an array, so nothing is returned by report() and stored in @array. Also, while your reverse-chop-reverse may be good kung-fu, it's much easier to substr($line,1,8) to get rid of the '#' at the beginning. Further, the substr means you don't need the chomp.

use strict; use warnings; my $path = "/efsprod/docmnt/"; my @array = &report(); foreach my $line (@array) { $line = $path . $line; print "$line\n"; } sub report() { open(F,"Textfile.txt") or die "$!\n"; my (@filelist); while(<F>) { push @filelist, substr($_,1,8); } return @filelist; }

Update(s): add path to array elements, not just to print statement. Remembered after that foreach aliases placeholder with array elements so we don't have to replace with C-style for.


In reply to Re: Unable to concatinate a Path to the array elements, which will have the values as return values from sunroutine by GotToBTru
in thread Unable to concatinate a Path to the array elements, which will have the values as return values from sunroutine by perladdict

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.