Second Update: Aaargh!
Wrong, wrong, wrong (except the genuflection)!

On the other hand (but with a bow and ++ to Marshall's remarks regarding \r, \n and the "$end of string anchor"), I do see the same issue Update: stricken text replaced read OP incorrectly</replace> see an issue, both with perl v 5.8.7 under Linux (Ubuntu) and with perl v 5.8.8 (Build 819) under W2K.

The issue is with the parenthesized ($version). See context.

Simple minded testing

#!/usr/bin/perl use strict; use warnings; #793602 my $line = "Version: 0\r\n"; my $line1 = "Version: 0\r\n"; my $line2 = "Version: 0\r\n"; my $line3 = "Version: 0\r\n"; $line =~ s/\n|\r//g; print "Line: |$line| ... \n"; $line1 =~ /^Version:\s(\d)$/; print "Line1: -|$line1|- ... \n"; $line2 =~ /^Version:(\s\d+)$/; print "Line2 with \\s inside capture: --|$line2|-- ... \n"; my ($version) = $line3 =~ /^Version:\s(\d)$/; print "Line3 (paren'ed \$version): ---|$version|--- ... \n"; =head OUTPUT Line: |Version: 0| ... Line1: -|Version: 0 |- ... Line2 with \s inside capture: --|Version: 0 |-- ... Use of uninitialized value in concatenation (.) or string at 793602.pl + line 22. Line3 (paren'ed $version): ---||--- ... =cut

In reply to Re: Can't match my regex by ww
in thread Can't match my regex by Saladino

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.