[24914] in Perl-Users-Digest
Perl-Users Digest, Issue: 7164 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 21 21:48:29 2004
Date: Tue, 21 Sep 2004 18:47:05 -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 Tue, 21 Sep 2004 Volume: 10 Number: 7164
Today's topics:
Statistics for comp.lang.perl.misc <gbacon@hiwaay.net>
Sybperl open client error <gyruss@hushmail.com>
What does this do ? !/somestring/ <matrix_calling@yahoo.dot.com>
Re: What does this do ? !/somestring/ (J. Romano)
Re: What does this do ? !/somestring/ <matrix_calling@yahoo.dot.com>
Re: What does this do ? !/somestring/ <mritty@gmail.com>
Re: Write to memory error <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 20 Sep 2004 22:12:08 -0000
From: Greg Bacon <gbacon@hiwaay.net>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <10kuldo4vh72c46@corp.supernews.com>
Following is a summary of articles spanning a 7 day period,
beginning at 13 Sep 2004 22:22:59 GMT and ending at
20 Sep 2004 21:49:25 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2004 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Excluded Posters
================
perlfaq-suggestions\@(?:.*\.)?perl\.com
faq\@(?:.*\.)?denver\.pm\.org
comdog\@panix\.com
Totals
======
Posters: 181
Articles: 535 (182 with cutlined signatures)
Threads: 113
Volume generated: 1105.9 kb
- headers: 495.7 kb (8,976 lines)
- bodies: 584.6 kb (17,986 lines)
- original: 346.4 kb (11,337 lines)
- signatures: 25.0 kb (664 lines)
Original Content Rating: 0.593
Averages
========
Posts per poster: 3.0
median: 2 posts
mode: 1 post - 80 posters
s: 3.7 posts
Posts per thread: 4.7
median: 3 posts
mode: 1 post - 32 threads
s: 5.8 posts
Message size: 2116.7 bytes
- header: 948.8 bytes (16.8 lines)
- body: 1119.0 bytes (33.6 lines)
- original: 663.1 bytes (21.2 lines)
- signature: 47.9 bytes (1.2 lines)
Top 20 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
22 41.8 ( 16.6/ 25.2/ 10.0) Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
22 45.5 ( 30.1/ 13.1/ 7.5) Sherm Pendley <spamtrap@dot-app.org>
22 33.9 ( 18.3/ 14.1/ 5.4) Gunnar Hjalmarsson <noreply@gunnar.cc>
21 42.7 ( 16.0/ 22.0/ 14.1) Michele Dondi <bik.mido@tiscalinet.it>
14 25.0 ( 13.7/ 11.3/ 8.0) Joe Smith <Joe.Smith@inwap.com>
12 24.1 ( 12.8/ 10.9/ 2.1) "John W. Krahn" <krahnj@telus.net>
11 23.8 ( 10.4/ 13.2/ 7.3) "A. Sinan Unur" <1usa@llenroc.ude.invalid>
11 19.1 ( 9.5/ 9.6/ 3.5) krakle <krakle@visto.com>
9 22.8 ( 8.2/ 14.6/ 11.5) "Looking" <adsense@whitehouse.com>
9 16.0 ( 8.1/ 7.9/ 3.8) "Jürgen Exner" <jurgenex@hotmail.com>
9 16.2 ( 8.4/ 7.8/ 4.3) Mark Clements <mark.clements@kcl.ac.uk>
9 16.5 ( 9.8/ 6.7/ 2.4) Shawn Corey <shawn.corey@sympatico.ca>
9 16.7 ( 8.1/ 8.6/ 4.8) "Paul Lalli" <mritty@gmail.com>
7 15.4 ( 6.7/ 7.8/ 6.8) abigail@abigail.nl
7 15.2 ( 4.4/ 9.8/ 5.3) ctcgag@hotmail.com
7 12.1 ( 4.6/ 7.0/ 4.0) corff@cis.fu-berlin.de
7 11.8 ( 5.1/ 6.8/ 4.3) wana <ioneabu@yahoo.com>
7 21.6 ( 8.1/ 13.5/ 5.3) jmfbahciv@aol.com
7 11.9 ( 6.4/ 5.5/ 3.0) Abhinav <matrix_calling@yahoo.dot.com>
6 10.9 ( 6.4/ 4.5/ 2.0) Brian McCauley <nobull@mail.com>
These posters accounted for 42.6% of all articles.
Top 20 Posters by Number of Followups
=====================================
(kb) (kb) (kb) (kb)
Followups Volume ( hdr/ body/ orig) Address
--------- -------------------------- -------
22 41.8 ( 16.6/ 25.2/ 10.0) Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
22 33.9 ( 18.3/ 14.1/ 5.4) Gunnar Hjalmarsson <noreply@gunnar.cc>
22 45.5 ( 30.1/ 13.1/ 7.5) Sherm Pendley <spamtrap@dot-app.org>
19 42.7 ( 16.0/ 22.0/ 14.1) Michele Dondi <bik.mido@tiscalinet.it>
14 25.0 ( 13.7/ 11.3/ 8.0) Joe Smith <Joe.Smith@inwap.com>
12 24.1 ( 12.8/ 10.9/ 2.1) "John W. Krahn" <krahnj@telus.net>
11 19.1 ( 9.5/ 9.6/ 3.5) krakle <krakle@visto.com>
11 23.8 ( 10.4/ 13.2/ 7.3) "A. Sinan Unur" <1usa@llenroc.ude.invalid>
9 16.7 ( 8.1/ 8.6/ 4.8) "Paul Lalli" <mritty@gmail.com>
9 16.0 ( 8.1/ 7.9/ 3.8) "Jürgen Exner" <jurgenex@hotmail.com>
9 16.5 ( 9.8/ 6.7/ 2.4) Shawn Corey <shawn.corey@sympatico.ca>
9 16.2 ( 8.4/ 7.8/ 4.3) Mark Clements <mark.clements@kcl.ac.uk>
7 15.2 ( 4.4/ 9.8/ 5.3) ctcgag@hotmail.com
7 15.4 ( 6.7/ 7.8/ 6.8) abigail@abigail.nl
7 21.6 ( 8.1/ 13.5/ 5.3) jmfbahciv@aol.com
6 10.9 ( 6.4/ 4.5/ 2.0) Brian McCauley <nobull@mail.com>
6 22.8 ( 8.2/ 14.6/ 11.5) "Looking" <adsense@whitehouse.com>
6 12.8 ( 5.7/ 7.1/ 4.6) Ozgun Erdogan <ozgune@gmail.com>
5 13.5 ( 7.7/ 5.6/ 1.4) Walter Bushell <proto@panix.com>
5 10.8 ( 6.0/ 4.5/ 1.1) albalmer@spamcop.net
These posters accounted for 48.9% of all followups.
Top 20 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
45.5 ( 30.1/ 13.1/ 7.5) 22 Sherm Pendley <spamtrap@dot-app.org>
42.7 ( 16.0/ 22.0/ 14.1) 21 Michele Dondi <bik.mido@tiscalinet.it>
41.8 ( 16.6/ 25.2/ 10.0) 22 Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
39.9 ( 5.7/ 33.7/ 33.0) 5 tadmc@augustmail.com
33.9 ( 18.3/ 14.1/ 5.4) 22 Gunnar Hjalmarsson <noreply@gunnar.cc>
25.0 ( 13.7/ 11.3/ 8.0) 14 Joe Smith <Joe.Smith@inwap.com>
24.1 ( 12.8/ 10.9/ 2.1) 12 "John W. Krahn" <krahnj@telus.net>
23.8 ( 10.4/ 13.2/ 7.3) 11 "A. Sinan Unur" <1usa@llenroc.ude.invalid>
22.8 ( 8.2/ 14.6/ 11.5) 9 "Looking" <adsense@whitehouse.com>
21.6 ( 8.1/ 13.5/ 5.3) 7 jmfbahciv@aol.com
21.4 ( 2.0/ 19.4/ 12.8) 3 Theo James <zippy@sanft.net>
19.1 ( 9.5/ 9.6/ 3.5) 11 krakle <krakle@visto.com>
16.7 ( 8.1/ 8.6/ 4.8) 9 "Paul Lalli" <mritty@gmail.com>
16.6 ( 5.9/ 10.4/ 5.6) 4 Chuck Dillon <spam@nimblegen.com>
16.5 ( 9.8/ 6.7/ 2.4) 9 Shawn Corey <shawn.corey@sympatico.ca>
16.2 ( 8.4/ 7.8/ 4.3) 9 Mark Clements <mark.clements@kcl.ac.uk>
16.0 ( 8.1/ 7.9/ 3.8) 9 "Jürgen Exner" <jurgenex@hotmail.com>
15.8 ( 4.4/ 11.5/ 4.9) 3 Greg Menke <gregm-news@toadmail.com>
15.4 ( 6.7/ 7.8/ 6.8) 7 abigail@abigail.nl
15.2 ( 4.4/ 9.8/ 5.3) 7 ctcgag@hotmail.com
These posters accounted for 44.3% of the total volume.
Top 8 Posters by Volume of Original Content (min. ten posts)
============================================================
(kb)
Posts orig Address
----- ----- -------
21 14.1 Michele Dondi <bik.mido@tiscalinet.it>
22 10.0 Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
14 8.0 Joe Smith <Joe.Smith@inwap.com>
22 7.5 Sherm Pendley <spamtrap@dot-app.org>
11 7.3 "A. Sinan Unur" <1usa@llenroc.ude.invalid>
22 5.4 Gunnar Hjalmarsson <noreply@gunnar.cc>
11 3.5 krakle <krakle@visto.com>
12 2.1 "John W. Krahn" <krahnj@telus.net>
These posters accounted for 16.7% of the original volume.
Top 8 Posters by OCR (minimum of ten posts)
===========================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.711 ( 8.0 / 11.3) 14 Joe Smith <Joe.Smith@inwap.com>
0.642 ( 14.1 / 22.0) 21 Michele Dondi <bik.mido@tiscalinet.it>
0.573 ( 7.5 / 13.1) 22 Sherm Pendley <spamtrap@dot-app.org>
0.557 ( 7.3 / 13.2) 11 "A. Sinan Unur" <1usa@llenroc.ude.invalid>
0.395 ( 10.0 / 25.2) 22 Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
0.382 ( 5.4 / 14.1) 22 Gunnar Hjalmarsson <noreply@gunnar.cc>
0.366 ( 3.5 / 9.6) 11 krakle <krakle@visto.com>
0.195 ( 2.1 / 10.9) 12 "John W. Krahn" <krahnj@telus.net>
Bottom 8 Posters by OCR (minimum of ten posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.711 ( 8.0 / 11.3) 14 Joe Smith <Joe.Smith@inwap.com>
0.642 ( 14.1 / 22.0) 21 Michele Dondi <bik.mido@tiscalinet.it>
0.573 ( 7.5 / 13.1) 22 Sherm Pendley <spamtrap@dot-app.org>
0.557 ( 7.3 / 13.2) 11 "A. Sinan Unur" <1usa@llenroc.ude.invalid>
0.395 ( 10.0 / 25.2) 22 Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
0.382 ( 5.4 / 14.1) 22 Gunnar Hjalmarsson <noreply@gunnar.cc>
0.366 ( 3.5 / 9.6) 11 krakle <krakle@visto.com>
0.195 ( 2.1 / 10.9) 12 "John W. Krahn" <krahnj@telus.net>
8 posters (4%) had at least ten posts.
Top 20 Threads by Number of Posts
=================================
Posts Subject
----- -------
41 Xah Lee's Unixism
31 $| (undocumented) magic?
23 Best place to learn perl?
17 anonymous hash notation question
16 Why this Regex not working?
16 hv_iterinit has side effects - who cares about PL theory
15 Protecting passwords in Perl scripts?
14 Rounding error in program
13 Need more efficient use of the substitution operator
12 killing a "nobody's" process and its group
10 rand() question
10 Replacing spaces
10 Is my algorithm wrong?
9 a splice question
9 Problem with global text search using Regular Expressions
8 Closures with $_?
8 newbie question
7 multiple assignments with a HoHoA
7 [OT?] SDBM file HUGE on disk
7 script portability problem
These threads accounted for 52.9% of all articles.
Top 20 Threads by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Subject
-------------------------- ----- -------
124.9 ( 52.8/ 70.7/ 35.9) 41 Xah Lee's Unixism
64.1 ( 30.6/ 30.4/ 16.0) 31 $| (undocumented) magic?
43.6 ( 21.5/ 21.6/ 12.8) 23 Best place to learn perl?
35.2 ( 15.3/ 18.6/ 10.3) 16 hv_iterinit has side effects - who cares about PL theory
34.2 ( 1.9/ 32.3/ 32.3) 2 Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
33.1 ( 13.6/ 18.3/ 10.1) 15 Protecting passwords in Perl scripts?
32.2 ( 16.5/ 14.9/ 9.0) 17 anonymous hash notation question
31.9 ( 3.2/ 23.6/ 10.0) 4 POE and Port Redirection
30.4 ( 16.2/ 14.0/ 6.0) 16 Why this Regex not working?
27.7 ( 13.6/ 13.7/ 7.7) 12 killing a "nobody's" process and its group
24.7 ( 12.8/ 11.6/ 7.7) 14 Rounding error in program
23.8 ( 11.4/ 11.9/ 7.6) 13 Need more efficient use of the substitution operator
19.1 ( 5.6/ 12.1/ 8.1) 8 Closures with $_?
18.8 ( 8.5/ 10.0/ 5.3) 10 Is my algorithm wrong?
17.8 ( 9.0/ 7.8/ 3.0) 9 a splice question
17.5 ( 8.5/ 8.9/ 2.9) 9 Problem with global text search using Regular Expressions
15.9 ( 9.1/ 6.4/ 3.2) 10 rand() question
15.8 ( 5.5/ 10.0/ 6.5) 6 move 7500 files to various directories
15.5 ( 8.4/ 7.1/ 2.4) 10 Replacing spaces
15.3 ( 5.8/ 9.1/ 5.4) 7 [OT?] SDBM file HUGE on disk
These threads accounted for 58.0% of the total volume.
Top 13 Threads by OCR (minimum of ten posts)
============================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.668 ( 7.7/ 11.6) 14 Rounding error in program
0.637 ( 7.6/ 11.9) 13 Need more efficient use of the substitution operator
0.602 ( 9.0/ 14.9) 17 anonymous hash notation question
0.593 ( 12.8/ 21.6) 23 Best place to learn perl?
0.560 ( 7.7/ 13.7) 12 killing a "nobody's" process and its group
0.553 ( 10.1/ 18.3) 15 Protecting passwords in Perl scripts?
0.551 ( 10.3/ 18.6) 16 hv_iterinit has side effects - who cares about PL theory
0.536 ( 5.3/ 10.0) 10 Is my algorithm wrong?
0.527 ( 16.0/ 30.4) 31 $| (undocumented) magic?
0.508 ( 35.9/ 70.7) 41 Xah Lee's Unixism
0.497 ( 3.2/ 6.4) 10 rand() question
0.425 ( 6.0/ 14.0) 16 Why this Regex not working?
0.340 ( 2.4/ 7.1) 10 Replacing spaces
Bottom 13 Threads by OCR (minimum of ten posts)
===============================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.668 ( 7.7 / 11.6) 14 Rounding error in program
0.637 ( 7.6 / 11.9) 13 Need more efficient use of the substitution operator
0.602 ( 9.0 / 14.9) 17 anonymous hash notation question
0.593 ( 12.8 / 21.6) 23 Best place to learn perl?
0.560 ( 7.7 / 13.7) 12 killing a "nobody's" process and its group
0.553 ( 10.1 / 18.3) 15 Protecting passwords in Perl scripts?
0.551 ( 10.3 / 18.6) 16 hv_iterinit has side effects - who cares about PL theory
0.536 ( 5.3 / 10.0) 10 Is my algorithm wrong?
0.527 ( 16.0 / 30.4) 31 $| (undocumented) magic?
0.508 ( 35.9 / 70.7) 41 Xah Lee's Unixism
0.497 ( 3.2 / 6.4) 10 rand() question
0.425 ( 6.0 / 14.0) 16 Why this Regex not working?
0.340 ( 2.4 / 7.1) 10 Replacing spaces
13 threads (11%) had at least ten posts.
Top 15 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
42 comp.lang.lisp
42 alt.folklore.computers
41 comp.lang.python
41 comp.unix.programmer
6 comp.os.linux.misc
6 comp.lang.perl
6 comp.unix.shell
6 comp.unix.questions
6 comp.unix.misc
6 comp.os.linux.help
4 alt.www.webmaster
3 comp.lang.perl.modules
3 comp.unix.bsd.freebsd.misc
1 news.answers
1 comp.answers
Top 20 Crossposters
===================
Articles Address
-------- -------
28 jmfbahciv@aol.com
24 Walter Bushell <proto@panix.com>
20 albalmer@spamcop.net
16 Chuck Dillon <spam@nimblegen.com>
12 Greg Menke <gregm-news@toadmail.com>
12 Patrick Scheible <kkt@drizzle.com>
10 "187" <bigal187@invalid.rx.eastcoasttfc.com>
10 nospam@nosite.zzz
8 roo@try-removing-this.darkboong.demon.co.uk
8 cbfalconer@worldnet.att.net
8 Bulent Murtezaoglu <bm@acm.org>
8 SM Ryan <wyrmwif@tango-sierra-oscar-foxtrot-tango.fake.org>
5 Matt Benson <mbens@hotmail.com>
5 Andres Monroy-Hernandez <andres@monroy.com>
4 Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
4 Brian Boutel <boutelbNOSPAM@acm.org>
4 "Coby Beck" <cbeck@mercury.bc.ca>
4 W i l l <willis3140@yahoo.com>
4 "Alan J. Flavell" <flavell@ph.gla.ac.uk>
4 Morten Reistad <firstname@lastname.pr1v.n0>
------------------------------
Date: Sat, 18 Sep 2004 16:01:30 +1000
From: "Gyruss" <gyruss@hushmail.com>
Subject: Sybperl open client error
Message-Id: <414bcf3b_1@news.iprimus.com.au>
Dear all,
Our sybperl (Sybase::CTlib) module in production appears to be broken.
Could I have a hand interpreting the error below? I'm not sure what the
problem is.
David
Open Client Message:
Message number: LAYER = (5) ORIGIN = (3) SEVERITY = (5) NUMBER = (131)
Message String: ct_init(): network packet layer: internal net library error:
Attempt to load protocol driver failed
Sybase::CTlib initialize: ct_init(12500) failed at
/opt/perl/5.8.0/lib/sun4-solaris/DynaLoader.pm line 249.
Compilation failed in require at ./extractTrades.pl line 12.
BEGIN failed--compilation aborted at ./extractTrades.pl line 12.
------------------------------
Date: Mon, 20 Sep 2004 18:37:49 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: What does this do ? !/somestring/
Message-Id: <lNA3d.26$AE3.128@news.oracle.com>
Hi,
I have a script :
#!/usr/bin/perl
use strict;
use warnings;
my $str="asd";
$str =~ !/asd/; # ! should not be there
print $str . "\n";
While running the above, I get the output
Use of uninitialized value in pattern match (m//) at t1.pl line 5.
asd
$
What does the ! do? How is it allowed at all ?
The question came up since someone was incorrectly using
$string =~ !// instead of
$string !~ //
That is worked in some cases (obviously with warnings/strictures off)
puzzled me. Hence this question
Thanks
Abhinav
------------------------------
Date: 20 Sep 2004 13:26:35 -0700
From: jl_post@hotmail.com (J. Romano)
Subject: Re: What does this do ? !/somestring/
Message-Id: <b893f5d4.0409201226.249c9af6@posting.google.com>
Abhinav <matrix_calling@yahoo.dot.com> wrote in message news:<lNA3d.26$AE3.128@news.oracle.com>...
>
> I have a script :
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my $str="asd";
> $str =~ !/asd/; # ! should not be there
> print $str . "\n";
>
> While running the above, I get the output
>
> Use of uninitialized value in pattern match (m//) at t1.pl line 5.
You get that warning because the line:
$str =~ !/asd/;
is equivalent to:
$str =~ ! ($_ =~ /asd/);
and also equivalent to:
$str =~ ($_ !~ /asd/);
which is probably not what you want. But since $_ probably has not
been set yet, you receive the warning message about a value (in this
case, $_) not being initialized.
The original programmer probably got confused because he/she had
read conditions like:
if (!/asd/)
{
# do something...
}
In this case, the condition:
!/asd/
is equivalent to:
! ($_ =~ m/asd/)
and also to:
$_ !~ m/asd/
The condition without the '!', like this:
/asd/
is equivalent to:
$_ =~ m/asd/
which may have let the programmer to believe that adding a '!'
(instead of an 'm') in front of the regular expression automatically
negates the match. It can negate the match, but only when the "$_ =~"
part is implied. The programmers's mistake was in thinking that '!'
negates the match everywhere.
I hope this helps clear things up, Abhinav.
-- Jean-Luc
------------------------------
Date: Tue, 21 Sep 2004 11:07:28 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: Re: What does this do ? !/somestring/
Message-Id: <6hP3d.58$AE3.95@news.oracle.com>
J. Romano wrote:
> Abhinav <matrix_calling@yahoo.dot.com> wrote in message news:<lNA3d.26$AE3.128@news.oracle.com>...
>
>>I have a script :
>>
>>#!/usr/bin/perl
>>use strict;
>>use warnings;
>>
>>my $str="asd";
>>$str =~ !/asd/; # ! should not be there
>>print $str . "\n";
>>
>>While running the above, I get the output
>>
>>Use of uninitialized value in pattern match (m//) at t1.pl line 5.
>
>
>
> You get that warning because the line:
>
> $str =~ !/asd/;
>
> is equivalent to:
>
> $str =~ ! ($_ =~ /asd/);
>
> and also equivalent to:
>
> $str =~ ($_ !~ /asd/);
>
Hmm ..
Reading this inside out, this would
1. check if $_ !~ /asd/
2. The return value from this check is taken an expression, which is on the
right side of $str
Hence, $str =~ expr # This is evaluated as $str =~ /expr/
This is what I could ascertain from "Programming Perl", page 90, "Binding
Operators". I hope I am correct ?
> which is probably not what you want. But since $_ probably has not
> been set yet, you receive the warning message about a value (in this
> case, $_) not being initialized.
>
> The original programmer probably got confused because he/she had
> read conditions like:
>
> if (!/asd/)
> {
> # do something...
> }
>
> In this case, the condition:
>
> !/asd/
>
> is equivalent to:
>
> ! ($_ =~ m/asd/)
>
> and also to:
>
> $_ !~ m/asd/
>
> The condition without the '!', like this:
>
> /asd/
>
> is equivalent to:
>
> $_ =~ m/asd/
>
> which may have let the programmer to believe that adding a '!'
> (instead of an 'm') in front of the regular expression automatically
> negates the match. It can negate the match, but only when the "$_ =~"
> part is implied. The programmers's mistake was in thinking that '!'
> negates the match everywhere.
>
> I hope this helps clear things up, Abhinav.
Definitely ! Thanks a lot for your detailed explanation :)
Regards
Abhinav
------------------------------
Date: Tue, 21 Sep 2004 13:36:52 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: What does this do ? !/somestring/
Message-Id: <U7W3d.255$sa.43@trndny05>
"J. Romano" <jl_post@hotmail.com> wrote in message
news:b893f5d4.0409201226.249c9af6@posting.google.com...
> Abhinav <matrix_calling@yahoo.dot.com> wrote in message
news:<lNA3d.26$AE3.128@news.oracle.com>...
> >
> > I have a script :
> >
> > #!/usr/bin/perl
> > use strict;
> > use warnings;
> >
> > my $str="asd";
> > $str =~ !/asd/; # ! should not be there
> > print $str . "\n";
> >
> > While running the above, I get the output
> >
> > Use of uninitialized value in pattern match (m//) at t1.pl line 5.
>
> You get that warning because the line:
>
> $str =~ !/asd/;
>
> is equivalent to:
>
> $str =~ ! ($_ =~ /asd/);
>
> and also equivalent to:
>
> $str =~ ($_ !~ /asd/);
This didn't make a lot of sense to me until I ran it through the Deparse
functionality of perl. It may help others to understand it if they see
the intermediary step here:
perl -MO=Deparse -e'$str ="asd"; $str =~ !/asd/;'
$str = 'asd';
$str =~ not /asd/;
-e syntax OK
So in the above, $str is being pattern matched against the result of
(not /asd/), which, as J. Romano correctly points out, is the equivalent
of
not ($_ =~ /asd/)
or
$_ !~ /asd
Paul Lalli
------------------------------
Date: Sat, 18 Sep 2004 11:41:52 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Write to memory error
Message-Id: <slrnckopag.446.tadmc@magna.augustmail.com>
yusufdestina <joericochuyt@msn.com> wrote:
> my @bp = 'mysqldump --user=$dbuser --password=$dbpass
> --add-drop-table $ref > $savepath/$ref.$date.$ext';
> What can I do
> to improve it?
Use the `correct` kind of quote characters?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 7164
***************************************