perhaps my actual example might help:

package ParseFiles; #use strict; use vars qw(@ISA @EXPORT $VERSION); use Exporter; $VERSION = 0.01; @ISA = qw(Exporter); @EXPORT = qw(&wad_parsefiles); $VERSION = 0.01; sub wad_parsefiles (@); ################################################### # sub parsefiles - args (@file list) return (@expanded file list) # take a list of filename arguments and expand it to a full # list, with wildcards globbed and @filelists opened # and included sub wad_parsefiles { my ($filespec, @files, @readfile); foreach $filespec (@_) { # convert drive:\dir\file to drive:\\dir\\file to make perl happy $filespec =~ s/\\/\\\\/g; # check if arg begins w/ "@", treat as list if so if ( $filespec =~ /^@/ ) { # remove leading @ $filespec =~ s/^@//; # open the list and dump contents into @files if (open(FILELIST, "$filespec")){ @readfile = <FILELIST>; chomp(@readfile); close(FILELIST); @files = (@files, @readfile); } } # glob it? elsif ( $filespec =~ /\*/ || $filespec =~ /\?/ ) { @files = (@files, glob("$filespec")); } else { @files = (@files, "$filespec"); } } return @files; }

first: apologies for sloppy syntax, i'm trying to get this thing to work at all before i clean up the mess. variable declarations and their ilk have been changed many times just trying to get this to run, so it might look weird in it's current state.

second: what i'd like to do here is to have this function to see a list of file specs (as provided on the cmd line or wherever), to expand that list with globbing and what have you, and than present the list to whomever calls this function. i'd really like it to be totally private outside of the function itself so i don't kill myself in namespace land. any thoughts on what's here? any idea what the heck i'm doing wrong?

luma::s-video


In reply to Re: dripping wet rank perl newbie ?: by luma
in thread How to make a module which exports a function, takes a list and returns a list? by luma

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.