[29791] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1034 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 15 00:09:43 2007

Date: Wed, 14 Nov 2007 21:09:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 14 Nov 2007     Volume: 11 Number: 1034

Today's topics:
        Automatic document generation <howachen@gmail.com>
    Re: Automatic document generation <1usa@llenroc.ude.invalid>
    Re: Back references <tadmc@seesig.invalid>
    Re: Binary to Decimal for >2**32 <ben@morrow.me.uk>
    Re: Command Line Arguments from a File <ben@morrow.me.uk>
    Re: Does a value exist in an array <simon.chao@gmail.com>
    Re: how to check whether the field is filled or empty i <ben@morrow.me.uk>
    Re: Matching substring <tadmc@seesig.invalid>
    Re: Matching substring <stoupa@practisoft.cz>
    Re: MySQL & Perl: Using a Dynamic SELECT Statement <tadmc@seesig.invalid>
        Question about printing XML using XML::Simple <some@body.com>
    Re: Question about printing XML using XML::Simple <stratfan@mindspring.com>
    Re: replace string contaning \n <tadmc@seesig.invalid>
        Session Cookie Glitch with mod_perl 2.03 and Apache 2.2 <stratfan@mindspring.com>
    Re: Use of uninitialized value in concatenation <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 14 Nov 2007 18:41:02 -0800 (PST)
From: howa <howachen@gmail.com>
Subject: Automatic document generation
Message-Id: <25a3dadf-c212-452f-ac08-46f9fbdb6da0@s19g2000prg.googlegroups.com>

Hello,

Anyone is using automatic document generation in Perl (like Javadoc,
which generate HTML pages for API references)

Any suggestions?



------------------------------

Date: Thu, 15 Nov 2007 03:08:37 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Automatic document generation
Message-Id: <Xns99E8E141CB9ADasu1cornelledu@127.0.0.1>

howa <howachen@gmail.com> wrote in news:25a3dadf-c212-452f-ac08-
46f9fbdb6da0@s19g2000prg.googlegroups.com:

> Anyone is using automatic document generation in Perl (like Javadoc,
> which generate HTML pages for API references)
> 
> Any suggestions?

perldoc perlpod

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>



------------------------------

Date: Thu, 15 Nov 2007 00:00:18 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Back references
Message-Id: <slrnfjn245.gm5.tadmc@tadmc30.sbcglobal.net>

Philip Potter <pgp@see.sig.invalid> wrote:
> Frieza wrote:
>> Hi I am studying Perl on my ciw course, I was wondering if anyone
>> could
>> tell me what back references are in regular expressions in plain
>> simple english, cause my course notes that I have, I need a dictionary
>> everytime I read a sentence.
>
> Get a copy of "Programming Perl" or "Learning Perl", both by Larry Wall 


Only one of those was by Larry, the other one was by Randal et. al.


> They're very good textbooks absolutely stuffed with plain simple 
> english.


That part, at least, is accurate.


> #!/usr/bin/perl
> use strict;


You should always enable warnings when developing Perl code.


> $string =~ /(a*) (b*)/;
> print "\$1 = '$1' and \$2 = '$2'\n";


You should never use the dollar-digit variables unless you have
first ensured that the match *succeeded*.

   if ( $string =~ /(a*) (b*)/ ) {
      print "\$1 = '$1' and \$2 = '$2'\n";
   }


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Thu, 15 Nov 2007 00:19:19 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Binary to Decimal for >2**32
Message-Id: <7tfs05-i03.ln1@osiris.mauzo.dyndns.org>


Quoth "Jürgen Exner" <jurgenex@hotmail.com>:
> Graham Drabble wrote:
> > I have been using a binary to decimal converter for number <2**16 for
> > a while now [...] which works fine.
> > I've now had to try and do the same conversion for numbers up to 2**
> > 48 and have discovered that this does not work for numbers >=2**32
> 
> > use Math::BigInt;
> [...]
> > Which works but seems very inelegant. Does anyone have a better
> > suggestion?
> 
> Use a perl that is compiled with 64-bit support on a 64-bit machine.

s/ on a 64-bit machine//;

~% perl -v

This is perl, v5.8.8 built for i386-freebsd-64int
<snip>

~% perl -le'print sprintf "%048b", 2**37'
000000000010000000000000000000000000000000000000

Ben



------------------------------

Date: Thu, 15 Nov 2007 00:13:36 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Command Line Arguments from a File
Message-Id: <gifs05-i03.ln1@osiris.mauzo.dyndns.org>


Quoth Jim Gibson <jimsgibson@gmail.com>:
> In article <1195065955.596294.100710@22g2000hsm.googlegroups.com>,
> <g4173c@motorola.com> wrote:
> > 
> > When I run the script below I get:
> > 
> > $ test.pl
> > 
> > -noclearcase -email mail
> > Unknown option: email mail
> > Died at test.pl line 10.
> 
> You are passing the string "-email mail" as a single element of the
> first-argument array to GetOptionsFromArray. Since this is not a valid
> option, GetOptionsFromArray issues the above message (first stripping
> the '-' which identifies an argument).

Note that you can use GetOptionsFromString, which is for exactly this
purpose. It uses Text::Shellwords (or rather, Text::ParseWords), which
supports shell-style quoting, so would correctly understand lines like

    -email "Foo Bar <foo@bar.com>"

as a user would probably expect. Since this will handle all the
splitting for you, you can do something more like

    use File::Slurp qw/read_file/;

    my $config = read_file $Control_File;

    # note that . doesn't match newline without /s
    $config =~ s/#.*//g;

    GetOptionsFromString $config, ...;

and get comments and quoting handled as the shell would.

Ben



------------------------------

Date: Wed, 14 Nov 2007 18:32:48 -0800 (PST)
From: nolo contendere <simon.chao@gmail.com>
Subject: Re: Does a value exist in an array
Message-Id: <71179168-a80b-40a6-9f68-244fcafca192@f3g2000hsg.googlegroups.com>

On Nov 14, 1:27 am, Peter Makholm <pe...@makholm.net> wrote:
> nolo contendere <simon.c...@gmail.com> writes:
> > my %suspend_list;
> > for my $account ( @accounts ) {
> >     $suspend_list{$account}++;
> > }
>
> > ...now you have all of the accounts as keys in the hash, and the
> > values for each key represents the number of times that key (account)
> > showed up. If you still want an array, you can simply:
>
> Note that this only works if $account is a simple value like a integer
> or a string. If it is references or perl objects it stringifies the
> value most often leaving you with a textual representation of the
> address of the object. You can't get back to the original object from
> this address.
>
> If you need to store references you have to use something like Xho's
> solution

Very good point.



------------------------------

Date: Thu, 15 Nov 2007 00:00:42 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: how to check whether the field is filled or empty in perl TK
Message-Id: <aqes05-i03.ln1@osiris.mauzo.dyndns.org>


Quoth king <hara.acharya@gmail.com>:
> I have  a perl TK UI. Where the user will feed the Register value.
> 
> ######################################################################
> our $t2=$left1->Label(-text=>'Register',-background=>'cyan')->pack();
> 
> our $pre1=$left2->Label(-background=>'green', -width=>12,-
> borderwidth=>2, -relief=>'sunken')->Entry()-> pack();
> our $ent1=$left2->Entry(-background=>'green', -width=>12,-
> borderwidth=>2, -relief=>'sunken')->pack();
> 
> $Register_1=$ent1->get();

It's usually easier to tie the Entry directly to the variable, like this

    my $Register_1;
    our $ent1 = $left2->Entry(
        -background   => 'green',
        -width        => 12,
        -borderwidth  => 2,
        -relief       => 'sunken',
        -textvariable => \$Register_1,
    )->pack;

Then the value in $Register_1 is always the same as the value of the
Entry: changing either changes the other automatically.

Also, variable names with numbers in are usually a sign you should be
using a data structure instead; most obviously an array, but it would
probably be better to give your widgets meaningful names and use a hash.

Ben



------------------------------

Date: Wed, 14 Nov 2007 06:00:19 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Matching substring
Message-Id: <slrnfjloqj.7hk.tadmc@tadmc30.sbcglobal.net>

m <modhak@gmail.com> wrote:

> I have a string :
>
> invokeEvent('5_290_act', true)" class="button">Add</button>


I'll assume the string is in the $_ variable.


> I need to get 5_290_act into a variable, can you please tell me how to
> construct regular expression for this.


   my($var) = /(\d\w+)/;


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Thu, 15 Nov 2007 02:44:44 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Matching substring
Message-Id: <fhg8ql$2btt$1@ns.felk.cvut.cz>

m wrote:
> Hi All
>
> I have a string :
>
> invokeEvent('5_290_act', true)" class="button">Add</button>
>
> I need to get 5_290_act into a variable, can you please tell me how to
> construct regular expression for this.
>
I assume that string is in variable $var

$var =~ s/^[^']+([^']+).+$/$1/;

or store to other variable without modify $var

$othervar = $1 if($var =~ m/^[^']+([^']+).+$/);

-- 

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail 
from another non-spammer site please.)




------------------------------

Date: Thu, 15 Nov 2007 00:00:18 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: MySQL & Perl: Using a Dynamic SELECT Statement
Message-Id: <slrnfjn1le.gm5.tadmc@tadmc30.sbcglobal.net>

Jason Carlton <jwcarlton@gmail.com> wrote:
>> > if ($check_username) {
>> >   if ($type eq "loose") {
>> >     $whereby1 = "WHERE username LIKE CONCAT('%',?,'%')";
>> >   }
>> >   else {
>> >     $whereby1 = "WHERE username=?";
>> >   }
>> >   my $sth = $dbh->prepare("SELECT id FROM posts " . $whereby1);
>> >   $sth->execute($search);
>>
>> You're using variables without showing us what they contain.  What's
>> in $search?  The fact that you haven't shown it suggests you consider
>> it irrlevant, but since you don't know what's going wrong, you
>> shouldn't make that assumption.
>
> In this case:
>
> $check_username = true;


 ... and what is the return value from the true() function then?

Or was that supposed to be a string?

(strings in Perl are delimited by quote characters.)


>> And here the block in which you declared this second $sth ends.  At
>> this point, the second $sth also ceases to exist.
>>
>> >   while (my ($this_id) = $sth->fetchrow_arrayref()) {
>>
>> Now you are attempting to use a variable that doesn't exist.


>> This tells me that you're not using strict.  Why?  It prevents you
>> from making mistakes like this.  It's also rude to ask us for help
>> before you ask the computer for help.


At least he wasn't sleep-deprived this time and blaming the resulting
mess on everybody else:


    Message-ID: <1158029547.380968.166590@e63g2000cwd.googlegroups.com>


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Wed, 14 Nov 2007 22:15:07 -0500
From: somebody <some@body.com>
Subject: Question about printing XML using XML::Simple
Message-Id: <srmdnUwx5r4mJKbanZ2dnUVZ_tuonZ2d@comcast.com>

I'm using XML::Simple to read an XML file named test.xml, which is listed
below.  I'm trying to print individual elements in the xml file like this:


my $xml = new XML::Simple(KeyAttr=>[], ForceArray => 1);
my $ref = $xml->XMLin($xmlfile);
##print Dumper($ref);

#These don't work

print $ref->{USER}->{NAME}->{FIRST_NAME};
print $ref->{XMLFILE}->{USER}->{NAME}->{FIRST_NAME};
print $ref->{USER}->{NAME}->{FIRST_NAME}->[0];


How can I print an individual element like <LAST_NAME>?

-Thanks


test.xml:

<XMLFILE>
<USER>
  <NAME>
    <FIRST_NAME> FRED </FIRST_NAME>
    <LAST_NAME> FLINTSTONE </LAST_NAME>
  </NAME>
  <ADDRESS>
    <ADD_LINE1> 123 Main Street </ADD_LINE1>
    <CITY> Bedrock </CITY>
    <STATE> CA </STATE>
    <ZIP> 23912 </ZIP>
  </ADDRESS>
</USER>
</XMLFILE>


------------------------------

Date: Wed, 14 Nov 2007 20:57:09 -0800 (PST)
From: stratfan <stratfan@mindspring.com>
Subject: Re: Question about printing XML using XML::Simple
Message-Id: <7927f4db-12ff-413e-b79d-ac377d798756@w73g2000hsf.googlegroups.com>

This should work.  You were on the right track for your syntax for the
references in the converted hash.  The problem might have been with
the call to XMLin.


stratfan

=================================

#!/usr/bin/perl

use XML::Simple;


my $testxml = <<"EOF";
<XMLFILE>
<USER>
  <NAME>
    <FIRST_NAME> FRED </FIRST_NAME>
    <LAST_NAME> FLINTSTONE </LAST_NAME>
  </NAME>
  <ADDRESS>
    <ADD_LINE1> 123 Main Street </ADD_LINE1>
    <CITY> Bedrock </CITY>
    <STATE> CA </STATE>
    <ZIP> 23912 </ZIP>
  </ADDRESS>
</USER>
</XMLFILE>
EOF


my $xmlResultHash = XMLin($testxml);

#XMLin defaults to dropping the top XML layer (XMLFILE in this case)

my $firstname = $xmlResultHash->{USER}->{NAME}->{FIRST_NAME};
my $lastname  = $xmlResultHash->{USER}->{NAME}->{LAST_NAME};
my $city      = $xmlResultHash->{USER}->{ADDRESS}->{CITY};

print "firstname = $firstname\n";
print "lastname  = $lastname\n";
print "city      = $city\n";

exit;

======================

myserver:/home/stratfan # perl xmltest.pl
firstname =  FRED
lastname  =  FLINTSTONE
city      =  Bedrock
myserver:/home/stratfan #


------------------------------

Date: Wed, 14 Nov 2007 06:08:13 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: replace string contaning \n
Message-Id: <slrnfjlp9d.7hk.tadmc@tadmc30.sbcglobal.net>

cieux87-fin@yahoo.com <cieux87-fin@yahoo.com> wrote:
> On 13 nov, 12:59, Tad McClellan <ta...@seesig.invalid> wrote:
>> cieux87-...@yahoo.com <cieux87-...@yahoo.com> wrote:
>> >  I try to change the string \nE by # E without success.
>>
>> >  $line=~ s/(\n\E/#E/g;
>>
>> That does not even compile.
>>
>> Two pieces of information are needed to evaluate the behavior
>> of a pattern match, the pattern and the string that it is
>> trying to match against.
>>
>> We need to see the contents of $line.
>>
>> Your choice of variable name implies that the answer is
>> given in the Perl FAQ:
>>
>>    perldoc -q match
>>
>>       I'm having trouble matching over more than one line.  What's wrong?
>>
>> --
>> Tad McClellan
>> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
>
> hello
>
> Here a solution.


I did not ask a question...


> sub chg_file {
>    # Open file to modify for reading
>    open(INPUTF,$ARGV[0]);


You should always, yes *always*, check the return value from open():

    open(INPUTF, $ARGV[0]) or die "could not open '$ARGV[0]' $!";


>         if (m/^E /) {
>                 print OUTFILE "\n" unless $lin < 2;
>         }
>         print OUTFILE " " unless m/^E /;


    if (m/^E /) {
        print OUTFILE "\n" unless $. < 2;
    }
    else {
        print OUTFILE " ";
    }


>         chop $_;


That is how you removed newlines 10 years ago. Where did you
learn your Perl?


   chomp $_;


>         $lin++;


You don't need to maintain a line counter yourself, perl is already
doing that for you, just use it ($.).


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Wed, 14 Nov 2007 20:29:57 -0800 (PST)
From: stratfan <stratfan@mindspring.com>
Subject: Session Cookie Glitch with mod_perl 2.03 and Apache 2.2.6
Message-Id: <13a922f2-a43b-4d6e-b5d4-de9dcf3f4d8f@e1g2000hsh.googlegroups.com>

I have an application originally written for the combination of Apache
1.3.31, mod_perl 1.39, and MySQL 4.0.16 that I'm moving to new servers
so I wanted to take the opportunity to migrate these components to the
latest versions:

Perl v5.8.8 built for i586-linux-thread-multi
Apache 2.2.6
mod_perl 2.0.3
OpenSSL 0.9.8g
libapreq 2-2.08
MySQL 5.0.45

The APIs for mod_perl changed substantially between 1.0 and 2.0 so
I've gone through the code that involves the old 1.0 vintage
Apache::xxxxxx modules and updated them to 2.0 equivalents in the
Apache2::xxxxxx or ModPerl::xxxxxxx modules.

The revamped application seems to work properly from the following
client combinations:

   * consumer Windows XP machine with IE 7.0
   * consumer Windows XP machine with Firefox

However, my corporate laptop (typical corporate locked down image)
with Windows XP and IE 6.0.2900 cannot establish a session within the
application.

In my application, the only changes required by mod_perl 2.0 were all
localized to the modules that handled authentication and session
management which were contained in modules named MyApp::CookieAuth and
CookieLib.  Some of the key "diffs" in the updated code are summarized
below:

CHANGES TO use STATEMENTS

< use Apache::Constants qw(DECLINED OK REDIRECT FORBIDDEN);
< use Apache::Cookie;
---
> use Apache2::Const qw(DECLINED OK REDIRECT FORBIDDEN);
> use Apache2::Cookie;
> use Apache2::RequestRec;
> use Apache2::Connection;

CHANGES TO COOKIE RETRIEVAL LOGIC

<       my %cookies = Apache::Cookie->fetch();
---
>      my %cookies = Apache2::Cookie->fetch();

CHANGES TO COOKIE SETTING LOGIC

<          $r->connection->auth_type('Basic');
<          $r->connection->user($session_key{'username'});
<          $r->header_out(
<           "Set-Cookie" => &CookieLib::generate(\%session_key)
<           );
---
>          $r->ap_auth_type('Basic');
>          $r->user($session_key{'username'});
>          $r->headers_out->add(
>           "Set-Cookie" => &CookieLib::generate(\%session_key)
>           );

The generate() method in the CookieLib library that actually sets the
session key data in responses appears as follows:

======================
sub generate {
   my ($args) = @_;
   my $query = new CGI;
   # this call to Crypt::CBC with only two parameters requires
   # the older 2.08 version instead of 2.18 -- the new version
   # requires a salt value which raises other compatibility issues
   my $cipher = new Crypt::CBC($KEYTEXT, $CIPHER);
   my $plaintext = join(':',
        $args->{'username'}, $ENV{'REMOTE_ADDR'},
        ($args->{'timestamp'} eq 0) ? 0 : time,
        $LIFETIME, rand(), $args->{'password'},
        $args->{'redirect'});
   print STDERR "CookieLib generate - $plaintext\n";
   my $ciphertext = encode_base64($cipher->encrypt($plaintext), "");
   return $query->cookie(
      -name   => $COOKIE_NAME,
      -domain => $COOKIE_DOMAIN,
      -path   => '/',
      -value  => $ciphertext
       );
}
======================

The normal login flow is:

1) surf to the / page of the server root,
2) Apache sees no session in the request so it serves a template with
an empty login form
3) submit a POST with a valid login, pull the login & password from
the POST request and authenticate it
4) if successful, set a cookie in the HTTP response header and send a
template for the logged in main page which is a frame that loads /
top.cgi (for navigation links) and /bottom.html (a static HTML file)
5) when the browser parses the logged in main page, it performs the
GETs for top.cgi and bottom.html giving the user their navigation
commands and a welcome page.

For logins from the corporate laptop, steps 1-4 all happen based upon
print debug statements writing to STDERR.  However, when Apache
processes the GET requests for top.cgi and bottom.html, the mod_perl
authentication handler isn't detecting the session data in the headers
(as if they weren't set by Apache when sending the reply in step #4)
so the logic in the authentication handler re-serves the default index
page (the login form) for each of those frame elements.

Logins from the other browsers work correctly and the print statements
for debugging show session data being retrieved from the subsequent
GET requests.  That tells me I don't have PERL5LIB envrionment
problems finding the modules, etc.

I suspect the problem is due to some interaction between the Apache
layer <Directory>, <FilesMatch> and <Location> directives (see below)
and the authentication logic used in my application's module named
Apache::CookieAuth.  However, I can't figure out why the problem is
browser dependent to figure out exactly where to fix the code.

Any ideas / suggestions would be greatly appreciated.


stratfan

=======================

#-----------------------------------------------------------------------
# These <Directory> directives set explicit rules for actual UNIX
# file paths referenced by Apache to serve incoming requests.
Requests
# are subjected to <Directory> rules, then <Files> and <FilesMatch>
# directives, then <Location> filters.
#-----------------------------------------------------------------------

<Directory "/myapp/htdocs">
    AddHandler cgi-script pl
    Options +Indexes +ExecCGI +FollowSymLinks +Includes +MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/myapp/templates">
   Order allow,deny
   Allow from all
   AllowOverride none
</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.cgi index.pl
</IfModule>

#------------------------------------------------------------------------
# Define pattern match to steer references to CGI scripts to the the
# registry within mod_perl while serving static content the old
# fashioned way
#------------------------------------------------------------------------
<FilesMatch "\.cgi">
    SetHandler perl-script
    PerlSetVar Filter On
    PerlResponseHandler ModPerl::Registry
    PerlSendHeader off
    Options +ExecCGI
</FilesMatch>

#------------------------------------------------------------------------
# Use <Location> to capture all incoming URI references and ensure
# they only get served if user has valid session -- session is managed
# by the Apache::CookieAuth module in the source tree located at
#   /myapp/lib/Apache/CookieAuth.pm
#------------------------------------------------------------------------
<Location />
   PerlAuthenHandler Apache::CookieAuth
   Options +ExecCGI
   AuthName "MYAPP"
   AuthType Basic
   Require valid-user
</Location>


------------------------------

Date: Thu, 15 Nov 2007 00:32:21 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Use of uninitialized value in concatenation
Message-Id: <llgs05-i03.ln1@osiris.mauzo.dyndns.org>


Quoth gil <gil.kovary@gmail.com>:
> when running Perl in "-w" mode, I get the following warning line:
> 
> "Use of uninitialized value in concatenation (.) or string at ./
> check_log.pl line 177, <DAT> line 261."
> 
> when line 177 is:
> 
> "if  ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$
> \]/)"

Presuming this shouldn't be wrapped, the important part of this is

    /$\]/

which is *not* an attempt to match a dollar followed by a square bracket
but an attempt to interpolate $\ followed by an invalid close-character-
class. Presumably $\ is undef. You need to escape the $:

    /^\[...(\d+?)\$\]/

or perhaps it was meant to be the other side of the \].

In a case like this it is well worth using alternate delimiters and /x:

    m{ ^
        \[ 
            (\d+?) / (\d+?) / (\d+?) \s+? 
            (\d+?) : (\d+?) : (\d+?) \$
        \]
    }x

*Much* more readable. Also, since the match is anchored and none of :, /
or \s match \d, none of those ?s are doing anything for you.

Ben



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1034
***************************************


home help back first fref pref prev next nref lref last post