[28305] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9669 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 31 03:05:53 2006

Date: Thu, 31 Aug 2006 00:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 31 Aug 2006     Volume: 10 Number: 9669

Today's topics:
    Re: 1 string from 3, making replacements more perlish <StillAwake@2am>
    Re: A Sort Optimization Technique: decorate-sort-dedeco <neoedmund@gmail.com>
    Re: Close a Running Sub-Process xhoster@gmail.com
    Re: Close a Running Sub-Process xhoster@gmail.com
    Re: Hi  Guys ! <vivekm1234@cyberspace.org>
    Re: Hi Guys ! <rajeshmvj@gmail.com>
    Re: Hi Guys ! <rajeshmvj@gmail.com>
    Re: Missing zeros in permutation. A perl bug or somethi <StillAwake@2am>
        new CPAN modules on Thu Aug 31 2006 (Randal Schwartz)
        New Group Cgi:Perl <rajeshmvj@gmail.com>
    Re: New Group Cgi:Perl <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: set in Perl? <zhushenli@gmail.com>
        Simple compiled regexp not working usenet@DavidFilmer.com
    Re: Simple compiled regexp not working <uri@stemsystems.com>
    Re: Simple compiled regexp not working usenet@DavidFilmer.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 30 Aug 2006 21:02:51 -0500
From: StuPedaso <StillAwake@2am>
Subject: Re: 1 string from 3, making replacements more perlish
Message-Id: <4ufcf25pu5qcp910eh8cqq9l7r9uffpn81@4ax.com>

On 30 Aug 2006 08:05:54 GMT, anno4000@radom.zrz.tu-berlin.de wrote:

>DJ Stunks <DJStunks@gmail.com> wrote in comp.lang.perl.misc:
>> StuPedaso wrote:
>> > I have 1 string made up of ones and zeros,
>> > a 2nd and 3rd of letters and number,
>> > and need to create a 4th where the 1's are successively pulled from 2,

and need to create a 4th where the 0's are successively pulled from 2,
sorry Paul, bet it was confusing.
>> > and the 1's from the 3rd.
>> >
>> > I can this do this in a QB/VB type way with
>> > $string1="001010110";
>> > $string2="a1bd3";
>> > $string3="0XY0";
>> >
>> > $l=0;$m=0;$p=0;
>> > $string4="";
>> >
>> > for $i (0..(length $string1)){
>> > $x=substr($string1,$l,1);$l++;
>> > if ($x==1){$string4.=substr($string3,$p,1);$p++;}
>> >    else   {$string4.=substr($string2,$m,1);$m++;}
>> > }
>> > print $string4;
>> > #a10bXdY03
>> >
>> > Not very perlish
>> > Also I don't want to modify srting1, as I will be using it again after
>> > I modify 2 and 3.
>> 
>> what do y'all think of this:
>> 
>>   #!/usr/bin/perl
>> 
>>   use strict;
>>   use warnings;
>> 
>>   my $key_string = '001010110';
>>   my $string_0   = 'a1bd3';
>>   my $string_1   = '0XY0';
>> 
>>   my %hash       = (
>>   	0 => [ split //, $string_0 ],
>>   	1 => [ split //, $string_1 ],
>>   );
>
>An array of two elements would do instead of the hash.
>
>    my @pair = map [ split //], $string_0, $string_1;
>
>>   my $result;
>>   for my $i (split //, $key_string) {
>>   	$result .= shift @{ $hash{$i} };
>>   }
>
>join() and map() can replace he loop:
>
>    my $result = join '', map shift( @{ $pair[ $_] }), split //, $key_string;
>
>(Untested code)
>
>Anno

Thanks for all the help. I hope to get a better grasp on perl someday.
It's also fun to see all the different ways people think, and the
various ways to do the same thing.

I guess I should have been a little more clear for those interested.
I'm creating string1 first,in a loop made up of X zeros and Y ones,
and it's much longer than this example. Then I'm creating sting2 in a
loop, string 3 in a loop, and they are permutations of smaller subsets
of data. This will allow me, hopefully, to process string 4.
Otherwise, I would have to create a huge permutation first, and delete
those that don't contain the data I'm looking for.
Stu


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

Date: 30 Aug 2006 18:35:02 -0700
From: "neoedmund" <neoedmund@gmail.com>
Subject: Re: A Sort Optimization Technique: decorate-sort-dedecorate
Message-Id: <1156988102.266873.18660@i42g2000cwa.googlegroups.com>

yeah, java also have 2 interface, Comparator and Comparable, which
equal to python's compareTo() and __cmp__()

Marc 'BlackJack' Rintsch wrote:
> In <1156723602.192984.49610@m79g2000cwm.googlegroups.com>, Tom Cole wrote:
>
> > In Java, classes can implement the Comparable interface. This interface
> > contains only one method, a compareTo(Object o) method, and it is
> > defined to return a value < 0 if the Object is considered less than the
> > one being passed as an argument, it returns a value > 0 if considered
> > greater than, and 0 if they are considered equal.
> >
> > The object implementing this interface can use any of the variables
> > available to it (AKA address, zip code, longitude, latitude, first
> > name, whatever) to return this -1, 0 or 1. This is slightly different
> > than what you mention as we don't have to "decorate" the object. These
> > are all variables that already exist in the Object, and if fact make it
> > what it is. So, of course, there is no need to un-decorate at the end.
>
> Python has such a mechanism too, the special `__cmp__()` method
> has basically the same signature.  The problem the decorate, sort,
> un-decorate pattern solves is that this object specific compare operations
> only use *one* criteria.
>
> Let's say you have a `Person` object with name, surname, date of birth and
> so on.  When you have a list of such objects and want to sort them by name
> or by date of birth you can't use the `compareTo()` method for both.
> 
> Ciao,
> 	Marc 'BlackJack' Rintsch



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

Date: 30 Aug 2006 22:05:43 GMT
From: xhoster@gmail.com
Subject: Re: Close a Running Sub-Process
Message-Id: <20060830180604.633$Gg@newsreader.com>

"mumebuhi" <mumebuhi@gmail.com> wrote:
> I have a problem closing a filehandle, which is a pipe to a forked
> process. The forked process basically tails a log file in another
> server. I need to stop the child process once a particular line is
> found.
>
> The code is as the following:

This not the code.  Please post real code.

> # start code
> my $fh = undef;

No need to predeclare it.

> my $child_process = "ssh username@host tail --follow=name
> file_to_be_tailed"

@host would be interpolated.  You need a pipe character at the end
of your string for the open to do what you want.  The lack of a trailing
semicolon creates a syntax error.


> open $fh, $child_process || Carp::confess("can't open $child_process:
> $!");

you have a precedence problem with the ||, it should be "or".

> while (<$fh>) {
>   chomp;
>   if (/successful/) {
>     last;
>   }
> }
> close $fh;
> # end code
>
> The script will block when it tries to close the filehandle. How do I
> force it to close while tail is still running?

You capture the pid of the running process (it is the return value of a
pipe open), and then you kill it just prior to the close.

my $pid=open my $fh, $cmd or die $!;
#....
kill 1,$pid;
close $fh;

You can use 2 or 15 instead of 1 to kill it with, but 1 seems to do the job
with generating spurious messages to STDERR on my system.  You can't use 13
(SIGPIPE) because if the child honored that signal, you wouldn't have the
problem in the first place.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 30 Aug 2006 23:05:51 GMT
From: xhoster@gmail.com
Subject: Re: Close a Running Sub-Process
Message-Id: <20060830190613.208$3s@newsreader.com>

xhoster@gmail.com wrote:
> "mumebuhi" <mumebuhi@gmail.com> wrote:
> >
> > The script will block when it tries to close the filehandle. How do I
> > force it to close while tail is still running?
>
> You capture the pid of the running process (it is the return value of a
> pipe open), and then you kill it just prior to the close.
>
> my $pid=open my $fh, $cmd or die $!;
> #....
> kill 1,$pid;
> close $fh;

Unfortunately, this seems to leave idle processes hanging around
on the remote server.  They will go away if the file they are tailing
ever grows enough so that tail -f fills up the pipe buffer, but if that
never happens then they might never get cleaned up.  Maybe the safest thing
to do is write a perl emulation of tail which runs on the remote server.
Then you have the termination criteria evaluated at the remove server
rather than the local one.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Thu, 31 Aug 2006 11:55:37 +0530
From: Vivek.M <vivekm1234@cyberspace.org>
Subject: Re: Hi  Guys !
Message-Id: <gnvcf2176rahs9ndv11gtpilec4ti8m9po@4ax.com>

> On 29 Aug 2006 22:56:18 -0700, "rajesh" <rajeshmvj@gmail.com> wrote:
>i want to know about the recruitment in perl for 1 year !

Hello Rajesh, IMHO ( in my humble opinion ) comp.lang.perl.misc is
news-group for Perl related questions, we aren't a recruitment agency.
Perhaps you should read the various posts in this NG  (news-group),
via Google Groups, to get a sense of what questions are acceptable
here; You might also want to read:
"http://www.catb.org/~esr/faqs/smart-questions.html". When you thing
you are done reading that page, please re-read it again!


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

Date: 30 Aug 2006 21:03:40 -0700
From: "rock" <rajeshmvj@gmail.com>
Subject: Re: Hi Guys !
Message-Id: <1156997020.611085.149710@b28g2000cwb.googlegroups.com>

Yes
i will explain i want to know abt the latest recuitment in perl for 1
year experienced programmars
 .
A. Sinan Unur wrote:
> "rock" <rajeshmvj@gmail.com> wrote in news:1156957254.244116.142240
> @h48g2000cwc.googlegroups.com:
>
> [ Please quote properly when you respond. Please do not quote signatures. ]
>
> >> What this percentage means ? can u explain
> >>
> >> 42.3%
>
> Well, frankly, Tad was being a tad imprecise. I think the 95% confidence
> interval for the percentage is [39.4%, 44.3%].
>
> Sinan
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> PS: If you want to be taken seriously, you might want to consider posting a
> question that makes sense. I have read and re-read your original post many
> times, and I cannot even begin to imagine being able to ascertain what you
> are asking.



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

Date: 30 Aug 2006 21:05:49 -0700
From: "rock" <rajeshmvj@gmail.com>
Subject: Re: Hi Guys !
Message-Id: <1156997149.907057.273670@i3g2000cwc.googlegroups.com>

Exactly every one is totally out of track...
i hope you can understand my question ..
Scott Bryce wrote:
> rock wrote:
>
> >
> >>What this percentage means ? can u explain
> >>
> >>42.3%
>
> It means that nobody here is able to make sense out of your original
> question.



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

Date: Wed, 30 Aug 2006 20:42:13 -0500
From: StuPedaso <StillAwake@2am>
Subject: Re: Missing zeros in permutation. A perl bug or something else?
Message-Id: <5necf2p8k7t9j0nl6dt9hocsir0cg8cr4h@4ax.com>

On Tue, 29 Aug 2006 07:42:30 -0500, StuPedaso <StillAwake@2am> wrote:
snip

>use Benchmark;
>my $start_time = new Benchmark;
>
>%BeenHere=();
>  my @incomplete = ':000111';
>  my %complete;
>  while ( my $item = pop( @incomplete ) ) {
>      process( $item );
>  }
>
>print join( "\n", sort keys %complete ), "\n";
>$many = scalar keys %complete;
>print "it has $many elements\n";
>
>my $end_time = new Benchmark;
>my $difference = timediff($end_time, $start_time);
>print "It took ", timestr($difference), "\n";
>
>  sub process {
>      my $item = shift;
>      $item =~ /(.*):(.*)/;
>    
> #     if ( $2 ) {

   if ( length $2 ) {
>
>$string="$1,$2";
>$BeenHere{$string}++;
>if ($BeenHere{$string}==1){
>      extend( $1, $2 );}
>      }
>      else {
>
>          $complete{$1} = 1;
>      }
>  }
>
>  sub extend {
>      my ( $done, $todo ) = @_;
>
>      my @chars = split( '', $todo );
>
>      foreach my $c ( @chars ) {
>          my $removed = $todo;
>          $removed =~ s/$c//;
>          push( @incomplete, "$done$c:$removed" ); 
>      }
>  }
>
>Thanks
>
>

Now that it's working correctly with length,  I tried to make a sub
out of it, so I can pass it string to caclulate (making) N
permutations with K1,K2,K3,..repeating characters.

 Why do I have to remove the MY from these 3 lines for it to work?
They aren't used anywhere before the sub.

print "Print Permutations\n";
$pat=':2111111111111111';
doperm($pat);

sub doperm {
%BeenHere=();
>  my @incomplete = ':000111';
>  my %complete;
>  while ( my $item = pop( @incomplete ) ) {

   @incomplete = $pat;
   %complete=();
   while ($item = pop( @incomplete ) ) {
      process( $item );
  }
}
print join( "\n", sort keys %complete ), "\n";


$many = scalar keys %complete;
print "it has $many elements\n";
}


  sub process {
code snipped
 .
 .
 .
  sub extend {
 .
 .
}



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

Date: Thu, 31 Aug 2006 04:42:15 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Aug 31 2006
Message-Id: <J4uIEF.Js@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Acme-Spider-0.02
http://search.cpan.org/~kasei/Acme-Spider-0.02/
frighten some other modules
----
Acme-WalkMethods-0.1
http://search.cpan.org/~llap/Acme-WalkMethods-0.1/
Develope the wrong way
----
Apache-VMonitor-2.06
http://search.cpan.org/~mjh/Apache-VMonitor-2.06/
Visual System and Apache Server Monitor
----
App-SimpleScan-1.22
http://search.cpan.org/~mcmahon/App-SimpleScan-1.22/
simple_scan's core code
----
Authen-DecHpwd-2.001
http://search.cpan.org/~zefram/Authen-DecHpwd-2.001/
DEC VMS password hashing
----
Bio-MCPrimers-2.3
http://search.cpan.org/~slenk/Bio-MCPrimers-2.3/
----
CGI-Untaint-telephone-0.03
http://search.cpan.org/~tjc/CGI-Untaint-telephone-0.03/
----
Catalyst-Model-JabberRPC-0.01
http://search.cpan.org/~fmerges/Catalyst-Model-JabberRPC-0.01/
JabberRPC model class for Catalyst
----
Catalyst-Model-JabberRPC-0.02
http://search.cpan.org/~fmerges/Catalyst-Model-JabberRPC-0.02/
JabberRPC model class for Catalyst
----
Catalyst-Model-XMLRPC-0.02
http://search.cpan.org/~fmerges/Catalyst-Model-XMLRPC-0.02/
XMLRPC model class for Catalyst
----
Catalyst-Model-XMLRPC-0.03
http://search.cpan.org/~fmerges/Catalyst-Model-XMLRPC-0.03/
XMLRPC model class for Catalyst
----
Catalyst-Plugin-DBIC-TemplateMaker
http://search.cpan.org/~zarquon/Catalyst-Plugin-DBIC-TemplateMaker/
Catalyst Plugin for Auto-generating simple Template Toolkit templates
----
Class-AbstractLogic-0.01_01
http://search.cpan.org/~phaylon/Class-AbstractLogic-0.01_01/
Handling Logic Abstractions
----
File-Binary-1.4
http://search.cpan.org/~simonw/File-Binary-1.4/
Binary file reading module
----
Games-RolePlay-MapGen-0.29
http://search.cpan.org/~jettero/Games-RolePlay-MapGen-0.29/
The base object for generating dungeons and maps
----
HTML-FormatText-WithLinks-0.07
http://search.cpan.org/~struan/HTML-FormatText-WithLinks-0.07/
HTML to text conversion with links as footnotes
----
Mail-SpamAssassin-3.1.5
http://search.cpan.org/~felicity/Mail-SpamAssassin-3.1.5/
Spam detector and markup engine
----
Math-Symbolic-Custom-LaTeXDumper-0.204
http://search.cpan.org/~smueller/Math-Symbolic-Custom-LaTeXDumper-0.204/
Math::Symbolic LaTeX output
----
Module-Packaged-0.86
http://search.cpan.org/~lbrocard/Module-Packaged-0.86/
Report upon packages of CPAN distributions
----
Number-WithError-0.06
http://search.cpan.org/~smueller/Number-WithError-0.06/
Numbers with error propagation and scientific rounding
----
Number-WithError-LaTeX-0.04
http://search.cpan.org/~smueller/Number-WithError-LaTeX-0.04/
LaTeX output for Number::WithError
----
Object-InsideOut-1.51
http://search.cpan.org/~jdhedden/Object-InsideOut-1.51/
Comprehensive inside-out object support module
----
Parallel-Queue-0.04
http://search.cpan.org/~lembark/Parallel-Queue-0.04/
fork or thread a list of closures N-way parallel
----
Process-YAML-0.04
http://search.cpan.org/~smueller/Process-YAML-0.04/
The Process::Serializable role implemented by YAML
----
SGML-Parser-OpenSP-0.99
http://search.cpan.org/~bjoern/SGML-Parser-OpenSP-0.99/
Parse SGML documents using OpenSP
----
SOAP-Lite-Simple-1.9
http://search.cpan.org/~llap/SOAP-Lite-Simple-1.9/
Please use SOAP::XML::Client instead
----
Socialtext-Resting-0.01
http://search.cpan.org/~synedra/Socialtext-Resting-0.01/
module for accessing Socialtext REST APIs
----
Sub-MustEval-0.01
http://search.cpan.org/~lembark/Sub-MustEval-0.01/
Force execution in an eval, prevents subroutines from throwing uncaught exceptions.
----
Sub-MustEval-0.02
http://search.cpan.org/~lembark/Sub-MustEval-0.02/
Force execution in an eval, prevents subroutines from throwing uncaught exceptions.
----
Task-App-Physics-ParticleMotion-1.02
http://search.cpan.org/~smueller/Task-App-Physics-ParticleMotion-1.02/
All modules required for the tk-motion application
----
Template-Plugin-HtmlToText-0.02
http://search.cpan.org/~fayland/Template-Plugin-HtmlToText-0.02/
Plugin interface to HTML::FormatText
----
Test-TestCoverage-0.01
http://search.cpan.org/~reneeb/Test-TestCoverage-0.01/
Test if your test covers all 'public' methods of the package
----
Text-Scan-0.28
http://search.cpan.org/~iwoodhead/Text-Scan-0.28/
Fast search for very large numbers of keys in a body of text.
----
Text-vCard-1.99
http://search.cpan.org/~llap/Text-vCard-1.99/
a package to edit and create a single vCard (RFC 2426)
----
Thread-Cancel-1.03
http://search.cpan.org/~jdhedden/Thread-Cancel-1.03/
Cancel (i.e., kill) threads
----
Thread-Suspend-1.07
http://search.cpan.org/~jdhedden/Thread-Suspend-1.07/
Suspend and resume operations for threads
----
WWW-Mechanize-XML-0.1
http://search.cpan.org/~whiteb/WWW-Mechanize-XML-0.1/
adds an XML DOM accessor to WWW::Mechanize.
----
Win32-Process-List-0.03
http://search.cpan.org/~rpagitsch/Win32-Process-List-0.03/
Perl extension to get all processes and thier PID on a Win32 system
----
threads-1.39
http://search.cpan.org/~jdhedden/threads-1.39/
Perl interpreter-based threads


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 30 Aug 2006 21:15:41 -0700
From: "rock" <rajeshmvj@gmail.com>
Subject: New Group Cgi:Perl
Message-Id: <1156997741.524510.299540@m79g2000cwm.googlegroups.com>

Introducing a new group Cgi:Perl  for everyone ..
join this Group ..
comments are welcomed.



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

Date: Wed, 30 Aug 2006 22:09:12 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: New Group Cgi:Perl
Message-Id: <ng7is3x8je.ln2@goaway.wombat.san-francisco.ca.us>

On 2006-08-31, rock <rajeshmvj@gmail.com> wrote:
> Introducing a new group Cgi:Perl  for everyone ..
> join this Group ..
> comments are welcomed.

Here's my comment: none of your posts have made a lick of sense.
If you want people to pay attention to you, pay more attention to
your writing.

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



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

Date: 31 Aug 2006 00:00:31 -0700
From: "Davy" <zhushenli@gmail.com>
Subject: Re: set in Perl?
Message-Id: <1157007631.138821.139380@m73g2000cwd.googlegroups.com>


Paul Lalli wrote:
> Davy wrote:
> > I used to use set (only contain one identical thing in one set) in
> > C++'s STL. I found set very useful that you can do something like
> > intersection. Is there something similar in Perl? Thanks!
>
[SNIP]
Hi,

Thanks! Sorry I forgot the hash table's feature.

Best regards,
Davy

> You generally want to use a hash.  The keys of a hash are distinct by
> definition.  If you tell us what your actual goal or problem is, we can
> give you more specific assistance...
>
> You may also be interested in:
> perldoc -q intersection
>
> my %unique;
> for (qw/foo bar baz bar foo baz baz) {
>   $unique{$_} ++;
> }
> my @set = keys %unique;
>
> # @set will contain three elements - foo, bar, and baz (in some random
> order)
> 
> Paul Lalli



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

Date: 30 Aug 2006 17:40:51 -0700
From: usenet@DavidFilmer.com
Subject: Simple compiled regexp not working
Message-Id: <1156984851.261000.183180@e3g2000cwe.googlegroups.com>

Kindly consider the following code which illustrates my question:

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

   my $line = '08/29/2006 to 08/30/2006';
   my $date_rx = qr{m!\d{2}/\d{2}/\d{4}!};

   print "regexp  matches\n" if $line =~ m!\d{2}/\d{2}/\d{4}!;
   print "date_rx matches\n" if $line =~ /$date_rx/;

__END__

The way I read perlop, both print statements should fire, as they
should be doing the exact same match. But I only see the first one.
grrr. This ought to be really simple.

-- 
David Filmer (http://DavidFilmer.com)



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

Date: Wed, 30 Aug 2006 20:49:32 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Simple compiled regexp not working
Message-Id: <x7zmdllof7.fsf@mail.sysarch.com>

>>>>> "u" == usenet  <usenet@DavidFilmer.com> writes:

  u> Kindly consider the following code which illustrates my question:
  u> #!/usr/bin/perl
  u>    use strict; use warnings;

  u>    my $line = '08/29/2006 to 08/30/2006';
  u>    my $date_rx = qr{m!\d{2}/\d{2}/\d{4}!};

ok, this will make you smack your head in a big D'Oh!

why do you think the m!! INSIDE the qr{} means anything special? the m//
is an op and pair of delimiters and not a regex itself. so since m and /
are not metachars (the / is not a { or }) then they are compiled to
themselves as plain chars to match. and they don't match.

  u>    print "regexp  matches\n" if $line =~ m!\d{2}/\d{2}/\d{4}!;
  u>    print "date_rx matches\n" if $line =~ /$date_rx/;

  u> __END__

  u> The way I read perlop, both print statements should fire, as they
  u> should be doing the exact same match. But I only see the first one.
  u> grrr. This ought to be really simple.

it is simple. you missed the part about the regex itself vs the op and
delimiters.

i will now let you smack yourself silly. no charge.

:)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 30 Aug 2006 18:01:51 -0700
From: usenet@DavidFilmer.com
Subject: Re: Simple compiled regexp not working
Message-Id: <1156986111.010017.181350@b28g2000cwb.googlegroups.com>

Uri Guttman wrote:

> it is simple. you missed the part about the regex itself vs the op and
> delimiters.

Yup, that's what I missed.  Gotta get my head screwed on straight.

> i will now let you smack yourself silly. no charge.

Owwww   (8^-0)

Thanks - I needed that.

-- 
David Filmer (http://DavidFilmer.com)



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

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 V10 Issue 9669
***************************************


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