G'day dcthehole,

Welcome to the monastery.

You give your error as being "at script.pl line 109" and then you write "Here is my actual script" which is followed by substantially less than 109 lines of code. So, either you've posted something other than script.pl or you've removed dozens of lines from it (probably near the beginning). Given that, the following is very much guesswork.

This line

my $filename = q{ServerLog\((\d+)-(\d+)-(\d+)@(\d+)-(\d+)\.log)};

looks like you're trying to generate a filename using data you've captured in a regexp; however, you're not even close with that syntax: you appear to have embedded the pattern in a literal string. Alternatively, you may be attempting to assemble a regexp but you don't show any code doing that. Take a look at perlretut - Perl regular expressions tutorial.

You have similar code when assigning to $qu_re1, $qu_re2 and $qu_re3. You don't show any use for those variables: I don't know why they're there or what they're supposed to do.

You should probably be calling your subroutines like sub_name() instead of &sub_name; however, maybe the missing code would reveal why you're doing it this way. Take a look at perlsub - Perl subroutines.

You'd do well to use strict at the start of your code. It's also preferable to use warnings instead of the -w switch (see perlrun).

If you need to ask follow-up questions, please follow the guidelines in "How do I post a question effectively?": you'll get a much better answer rather than guesses.

-- Ken


In reply to Re: Help w/ regex in filename by kcott
in thread Help w/ regex in filename by dcthehole

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.