[24958] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7208 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 4 21:07:11 2004

Date: Mon, 4 Oct 2004 18: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           Mon, 4 Oct 2004     Volume: 10 Number: 7208

Today's topics:
        足球 賽馬 六合彩專業分析預測 hello@yahoo.com.hk
        Can perl SHA1 module be applied to files? (Lee Hibberd)
    Re: Explorer doesn't run my perl cgi program like netsc (wana)
    Re: Getopt::Long install problems (Harry)
    Re: Getopt::Long install problems <bill@karwin.com>
    Re: Getopt::Long install problems <usa1@llenroc.ude.invalid>
    Re: Help needed with Hash <glex_nospam@qwest.invalid>
    Re: How to flush a stinkin' socket? <nobull@mail.com>
        initialize a list <tlviewer@yahoo.com>
    Re: initialize a list (Jay Tilton)
    Re: Is PHP still slower than Perl? <postmaster@castleamber.com>
        Net::Netmask and cidrs2inverse function (fedexarg)
        Question about syntax and default variables <gj@freeshell.org>
    Re: Question about syntax and default variables <abigail@abigail.nl>
    Re: reading a list of files <noreply@gunnar.cc>
    Re: reading a list of files <tadmc@augustmail.com>
    Re: reading a list of files (gumby)
        regex error <bcaligari@nospam.fireforged.com>
    Re: regex error <noreply@gunnar.cc>
    Re: regex error <abigail@abigail.nl>
    Re: regex error <bcaligari@nospam.fireforged.com>
    Re: removing empty split() fields (dutone)
    Re: removing empty split() fields <noreply@gunnar.cc>
    Re: removing empty split() fields <tadmc@augustmail.com>
        Signal handling and modules <william@wilbur.25thandClement.com>
    Re: Two write to a file with flock, what will happen? ctcgag@hotmail.com
        use sed in perl (perry zhou)
    Re: use sed in perl <abigail@abigail.nl>
    Re: Version?  Getopt::Long <mritty@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 30 Sep 2004 12:35:53 GMT
From: hello@yahoo.com.hk
Subject: 足球 賽馬 六合彩專業分析預測
Message-Id: <cjguj9$l561314@imsp212.netvigator.com>

http://www.soccerfigure.com 足球數據分析預測
歐洲主要足球聯賽統計數據,波盤賠率分析,
球隊狀態及入球指數賽果分析預測...
 
http://www.horsefigure.com 賽馬數據分析預測
香港賽馬統計數據,賽績評分數據,賽馬投注彩池分析,
賽馬預測公式,人工智能分析預測及投注策略...

http://www.lottofigure.com 六合彩走勢路數分析預測
香港六合彩走勢專業分析包括總和大小,
特別號碼單雙,相連號碼,六或七個單雙數量,
七個顏色數量走勢預測,幸運號碼產生工具...

http://www.stockfigure.com 股票市場數據分析預測
香港股票價格走勢十年歷史數據,
日線,週線及月線指數移動平均趨勢分析圖表...


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

Date: 4 Oct 2004 09:34:39 -0700
From: l.hibberd@nls.uk (Lee Hibberd)
Subject: Can perl SHA1 module be applied to files?
Message-Id: <cd2f693b.0410040834.67458fd3@posting.google.com>

Hello all

I have used sha1_file in php and want to know if there is an
equivalent in perl. i.e. I want to produce a sha1 value based on the
composition of the file and not the filename. I have used the perl
sha1 digest, but I'm unsure if this is working correctly. One reason
for my uncertainty is that the sha1 values produced by php sha1_file
differ. The second reason is I guess I would need to feed the
bit-stream through the sha1 in perl as if it were a line of text, and
I'm not sure that my code does that:

my $fn="$file";
	my $fh = new IO::File;
	$fh->open($fn) or @row = $dbh->do( "
           UPDATE All_Locations SET SHA1Date = Date(),SHA1Time =
Time(),ErrorCode=\'NoFile\' WHERE FileID=$row[0]
      " );
	$digest = new Digest::SHA1;
	$digest->addfile($fh);
	$fh->close;	
	$sha1var = $digest->hexdigest;
	print $file.": ".$sha1var."\n";

Any help would be greatly appreciated.

Lee Hibberd
National Library of Scotland


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

Date: 4 Oct 2004 11:13:21 -0700
From: ioneabu@yahoo.com (wana)
Subject: Re: Explorer doesn't run my perl cgi program like netscape does.
Message-Id: <bf0b47ca.0410041013.633ca0d4@posting.google.com>

> > Check if the form is being submitted at all - if the CGI never runs, the 
> > problem is guaranteed to be in the client. If it's in the client, check 
> > for HTML errors - you *did* validate the HTML, right? And check for 
> > JavaScript problems, especially if there's form validation or some funky 
> > onSubmit scripting that could prevent the form from being sent if it's 
> > buggy.
> > 
> 

Maybe this is unrelated, but I had a problem with Konqueror when I
tried to pass a session id through the url:

$url = url()."?sess_id=$session_id";
print a({-href=>$url},'next page');

If I clicked on the link, the url would change in the url window at
the top, but the page would be unchanged until I clicked my mouse on
the url and hit enter.  I did not have this problem with any other
browser (IE and Netscape) but I stopped using this code because I like
Konqueror otherwise.


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

Date: Mon, 04 Oct 2004 22:00:54 GMT
From: harryooopotter@hotmail.co_ (Harry)
Subject: Re: Getopt::Long install problems
Message-Id: <qKj8d.24361$N%.10317@edtnps84>

Mark J Fenbers wrote...
> Does the fact that the supposedly
>zipped tar file ends in a tar.tar extention instead of a tar.gz
>extention have anything to do with my problem?  

Looks like it's *your* problem.
Before you download, the source link property should say
Getopt-Long-2.34.tar.gz. So, if your download has the name tar.tar
instead of tar.gz, your browser is not set up properly.

If your browser download it in ASCII mode, your tar ball would be
screwed up. Try download it again using wget.

wget http://www.cpan.org/modules/by-module/Getopt/Getopt-Long-2.34.tar.gz

Ten uppack it using gnu tar.

tar -xzf Getopt-Long-2.34.tar.gz

Good luck.
 



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

Date: Mon, 04 Oct 2004 16:08:00 -0700
From: Bill Karwin <bill@karwin.com>
Subject: Re: Getopt::Long install problems
Message-Id: <cjsl4c01qsj@enews2.newsguy.com>

Mark J Fenbers wrote:

> I've successfully installed numerous Perl modules from CPAN.  (I almost
> get the feeling that I know what I am doing.)  But I downloaded the
> latest release of Getopt::Long and ran 'perl Makefile.PL' which created
> the Makefile, but complained that pod2man was not in the PATH (but, "Oh,
> yes it is!").  Nonetheless, I ran 'make' and it gave me this message:
> 
> make:87: *** missing separator.  Stop.
> 
> So I checked out line 87 and found this line:
> 
> installman1

Shouldn't this be "INSTALLMAN1DIR"?  I think your MakeMaker isn't 
producing the Makefile correctly.  What version of Perl and 
ExtUtils::MakeMaker are you using?

Run these commands:
   perl --version
   perl -MExtUtils::MakeMaker -e 'print "$ExtUtils::MakeMaker::VERSION\n";'

I don't think it's an issue of your tar file getting corrupted.  If it 
had, most likely you wouldn't be able to extract the files at all.

I'm using Perl 5.8.4, ExtUtils::MakeMaker 6.17, gmake 3.80 on FreeBSD 
4.9.  I tried downloading and building Getopt::Long, using the cpan 
shell, and it worked fine.

Regards,
Bill K.


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

Date: 5 Oct 2004 00:04:38 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: Getopt::Long install problems
Message-Id: <Xns9578CC79A7D3Basu1cornelledu@132.236.56.8>

Mark J Fenbers <Mark.Fenbers@noaa.gov> wrote in
news:4161E0C7.55C3F5B0@noaa.gov: 

Mark:

I am going to suggest that you read the posting guidelines for this group 
before proceeding any further.

Avoid top-posting.

> Attachment decoded: untitled-2.txt

Avoid attachments.

And the main reason I am even bothering to write this, do not post multiple 
copies of the same message. Given the fact that you posted the exact same 
message at 6:49, 6:55, 6:58, 7:00, 7:03, 7:08, and 7:11 EST I am inclined 
not to think it was by accident.

Sinan.


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

Date: Mon, 04 Oct 2004 10:06:13 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Help needed with Hash
Message-Id: <GFd8d.3$n_5.24642@news.uswest.net>

Page wrote:
> I'm sure this has an easy answer, but I'm still learning.
> 
> I have the following code...
> 
> use XML::Simple;
> my $simple = XML::Simple->new();
> my $struct = $simple->XMLin("$map", forcearray => 1, keeproot => 1);
> 
> for (@{$struct->{treemap}->[0]->{label}}) {
>    my $lbldate = $_->{date}; if (ref($lbldate) eq "HASH") { $lbldate =
> ""; }
>    print '<div unselectable="on" class="lbl">'."\n";
>    print $_."\n";  # this is the line with the problem
>    print "</div>\n";
> }
> 
> which reads the following XML file (code snipped to show relavent
> XML):
> <label date="09/28/2004">CONTRIBUTION</label>
> <label date="09/28/2004">COST</label>
> <label date="09/28/2004">MILES</label>
> 
> 
> Everything seems to work fine, but instead of getting the words
> "CONTRIBUTION", "COST", or "MILES", I get "HASH(0x1c282ec)".  This
> same code works fine for some other XML, so I'm confused.  How do I
> fix the line above to display the contents of the label object and not
> the HASH?

Access each element of the hash.  $_ is the element of the 
$struct->{treemap}->[0]->{label} array, which seem to contain a hash, so 
then you go through each key of the hash.

Give Data::Dumper a try, to display how the data is stored, and to help 
you diagnose how you can access the hash in the future.

 > use XML::Simple;
use Data::Dumper;
 > my $simple = XML::Simple->new();
 > my $struct = $simple->XMLin("$map", forcearray => 1, keeproot => 1);
print Dumper($struct);

You could also call Dumper in your foreach, to see the structure of $_, 
to help you print the values you need.


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

Date: Mon, 04 Oct 2004 19:00:29 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: How to flush a stinkin' socket?
Message-Id: <cjs2rh$8nm$1@sun3.bham.ac.uk>

your name here wrote:

> You may be familar with the following code snippet as it was taken
> from some posts in this group. However, whatever I do, I cannot get
> this message through the socket immediately which causes the other
> side to determine I am in trouble because it hasn't received a health
> check. The message finally shows up after I issue the shutdown
> command, which is unacceptable. Any ideas? Windows peculiarity?

How are you sure that it is not being sent?   Is it possible that 
there's unwanted buffering at the reading end?  Perhaps the reading 
application is waiting for some kind of end-of-message seqence that does 
not appear in you message.



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

Date: Mon, 04 Oct 2004 20:02:05 GMT
From: "gnu valued customer" <tlviewer@yahoo.com>
Subject: initialize a list
Message-Id: <1%h8d.4178$Xk1.87@trnddc02>

Hello,

strings
--------
my ($a, $b, $c, $d, $e) =3D ''; # only $a is defined

my ($a, $b, $c, $d, $e) =3D ('') x 5; # all 5 are defined

numbers
--------
my ($a, $b, $c, $d, $e) =3D (0) x 5; # works for int too

Is the above use of the repetition operator (x) a
good practice for initializing a List, or are there
better ways?

tia,
tlviewer


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

Date: Mon, 04 Oct 2004 22:37:28 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: initialize a list
Message-Id: <4161ce64.71868190@news.erols.com>

"gnu valued customer" <tlviewer@yahoo.com> wrote:

: strings
: --------
: my ($a, $b, $c, $d, $e) = ''; # only $a is defined
: 
: my ($a, $b, $c, $d, $e) = ('') x 5; # all 5 are defined
: 
: numbers
: --------
: my ($a, $b, $c, $d, $e) = (0) x 5; # works for int too
: 
: Is the above use of the repetition operator (x) a
: good practice for initializing a List,

Do the variables in the list really need to be initialized?  Giving them
values of 0 or '' doesn't do anything Perl can DWIM on its own.

: or are there better ways?

My personal preference in the extraordinarily rare circumstance that
initialization is necessary:

    $_ = 0 for
    my ($a, $b, $c, $d, $e);



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

Date: 4 Oct 2004 19:53:09 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Is PHP still slower than Perl?
Message-Id: <Xns9578976BFD654castleamber@130.133.1.4>

Chris Hope <blackhole@electrictoolbox.com> wrote in
news:3E48d.9683$JQ4.648438@news.xtra.co.nz: 

> John Bokma wrote:
> 
>>> "Tim Tyler" <tim@tt1lock.org> wrote in message
>>> news:I50oKB.rM@bath.ac.uk...
>>>> In comp.lang.php John Bokma <postmaster@castleamber.com> wrote or
>>>> quoted:
>>>>
>>>>> For me Perl is #1 (if possible) because PHP is probably the worst
>>>>> designed
>>>>> language ever.
>>>>
>>>> PHP was never designed.  It evolved.
>>> 
>>> Most languages evolve for the simple reason that nobody ever gets it
>>> right the very first time. Ideas change over time, so languages must
>>> change to keep up with the times.
>> 
>> But it can't hurt to have a good look at how other languages are
>> designed before you start with the primordial soup (did PHP already
>> reach that stage?) I mean just reading a few books on general
>> language design could have given the maker(s) at least some clue.
> 
> That may be so, but PHP was initially created as a quick and simple
> way for the creator to measure the number of people who viewed his CV
> online, and it evolved from there. Interestingly enough, it started
> off as a collection of libraries written in Perl,

Yeah, I know. Sadly the creator thought he could do a better job? He 
should have had a better look at Perl and its design considerations, and 
maybe learned from it.

> and then moved to an
> implementation written in C with version 2.0. 
> 
> If you are interested, you can read the history at
> http://www.php.net/history

Thanks. Perl also started as a tool for a specific task. But the 
designer did probably more research or had more experience ;-)

On that page:
"The syntax itself was similar to that of Perl, albeit much more 
limited, simple, and somewhat inconsistent."

Sadly, in PHP the focus has been on that inconsistent part, or so it 
seems to me.

-- 
John                               MexIT: http://johnbokma.com/mexit/
                           personal page:       http://johnbokma.com/
        Experienced programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html


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

Date: 4 Oct 2004 13:42:18 -0700
From: fedecam@hotmail.com (fedexarg)
Subject: Net::Netmask and cidrs2inverse function
Message-Id: <6683b7a6.0410041242.3b1fe894@posting.google.com>

I have a file which has a list of IP subnet blocks .

Like this 

200.61.191.0/30
200.61.191.4/30
200.61.191.12/30

I would like to find the missing subnets that would fill the gaps in
the list. for the complete /24 net.

I ve tried to use the cidrs2inverse function with no luck.

Can someone give an example ? using this or any other module.

Thanks in advance.


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

Date: Mon, 4 Oct 2004 20:23:05 +0000 (UTC)
From: Gerald Jones <gj@freeshell.org>
Subject: Question about syntax and default variables
Message-Id: <cjsbf9$757$1@chessie.cirr.com>



Two perl programs:

$ echo dajsjd hdajshd | perl -ne '($foo, $bar) = split; print "1. $foo 2. $bar\n"'
1. dajsjd 2. hdajshd
$ echo dajsjd hdajshd | perl -ne '($foo, $bar) = split @_; print "1. $foo 2. $bar\n"'
1. dajsjd hdajshd
 2. 
$

Given no args, doesn't split operate on @_?  Also, isn't the default string to
split on a whitespace?  So why the above differences?


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

Date: 04 Oct 2004 20:38:06 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Question about syntax and default variables
Message-Id: <slrncm3d5e.qgs.abigail@alexandra.abigail.nl>

Gerald Jones (gj@freeshell.org) wrote on MMMMLII September MCMXCIII in
<URL:news:cjsbf9$757$1@chessie.cirr.com>:
??  
??  
??  Two perl programs:
??  
??  $ echo dajsjd hdajshd | perl -ne '($foo, $bar) = split; print "1. $foo 2. $bar\n"'
??  1. dajsjd 2. hdajshd
??  $ echo dajsjd hdajshd | perl -ne '($foo, $bar) = split @_; print "1. $foo 2. $bar\n"'
??  1. dajsjd hdajshd
??   2. 
??  $
??  
??  Given no args, doesn't split operate on @_?

No. As the documentation says, split with no arguments splits $_ on 
whitespace.

??  Also, isn't the default string to split on a whitespace?

The default string to split on is whitespace.

?? So why the above differences?

Well, they can't *both* be the default, can they? Either the default
is to take @_ as arguments (which is doesn't), or to use whitespace
to split on (which it does).


Perhaps you are confused the behaviour of split in scalar context - then 
it populates @_. This is now considered less than ideal.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Mon, 04 Oct 2004 18:07:03 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: reading a list of files
Message-Id: <2sdaq8F1j1lqoU1@uni-berlin.de>

john williams wrote:
> I have a list of files:
> 
> basename_001.ext
> ...
> basename_1000.ext
> 
> I would like to be able to read them one by one, and process each
> file, then write the files one by one as:
> 
> basename_out_0001.ext
> ...
> basename_out_1000.ext
> 
> due to the large number of files, I need this to be automated.

What you want to do is possible, and Perl is a possible programming 
language.

> Any help would be appreciated,

Help with what? Writing your program for you? No way!

Please study the posting guidelines for this group:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

I don't know how much Perl you know, but maybe you need to start here:

     http://learn.perl.org/

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 4 Oct 2004 11:51:57 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: reading a list of files
Message-Id: <slrncm2vtd.1fn.tadmc@magna.augustmail.com>

john williams <john_williams4321@hotmail.com> wrote:

> I have a list of files:
> 
> basename_001.ext
> ...
> basename_1000.ext
> 
> I would like to be able to read them one by one, 


   perldoc -f opendir
   perldoc -f readdir
   perldoc -f closedir
   perldoc -f glob


> and process each
> file, then write the files one by one as:


   perldoc -f rename
   perldoc -f open


> basename_out_0001.ext
> ...
> basename_out_1000.ext


See the "s/PATTERN/REPLACEMENT/egimosx" section in:

   perldoc perlop


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 4 Oct 2004 13:06:44 -0700
From: georgeziv@hotmail.com (gumby)
Subject: Re: reading a list of files
Message-Id: <878baabf.0410041206.4706db36@posting.google.com>

john_williams4321@hotmail.com (john williams) wrote in message news:<298e5c19.0410040652.4a8732e2@posting.google.com>...
> Hi, 
> 
> I have a list of files:
> 
> basename_001.ext
> ...
> basename_1000.ext
> 
> I would like to be able to read them one by one, and process each
> file, then write the files one by one as:
> 
> basename_out_0001.ext
> ...
> basename_out_1000.ext
> 
> 
> due to the large number of files, I need this to be automated.
> 
> Any help would be appreciated, thanks in advance
> John

Try this:
my @filesToBeProcessed = <$directoryToBeProcessed/*.ext >
foreach(@filesToBeProcessed)
{
#open each file and do what you need then close the file.
}

Should work for you globs the directory you specify and puts the files
with path into the array.  Then step through the array and do what
ever you need to with each file.


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

Date: Mon, 04 Oct 2004 22:37:14 +0000
From: Brendon Caligari <bcaligari@nospam.fireforged.com>
Subject: regex error
Message-Id: <4161d09b$0$94914$bed64819@news.gradwell.net>

I cannot understand what i'm doing wrong but my script fails to compile 
("panic: end_shift");

$SMContents =~ m/^User data: '(.{$SMMessageLength})'$/ms

The following two alternatives work well

$SMContents =~ m/^User data: '(.{18})'$/ms

$SMContents =~ m/^User data: '(.{$SMMessageLength})'/ms


B.


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

Date: Tue, 05 Oct 2004 00:55:51 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: regex error
Message-Id: <2se2pnF1kfd8uU1@uni-berlin.de>

Brendon Caligari wrote:
> I cannot understand what i'm doing wrong but my script fails to
> compile ("panic: end_shift");
> 
> $SMContents =~ m/^User data: '(.{$SMMessageLength})'$/ms
> 
> The following two alternatives work well
> 
> $SMContents =~ m/^User data: '(.{18})'$/ms
> 
> $SMContents =~ m/^User data: '(.{$SMMessageLength})'/ms

There is nothing with any of the expressions above that should cause a
script to not compile. Please post a short but *complete* program that
illustrates the problem.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 04 Oct 2004 23:17:45 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: regex error
Message-Id: <slrncm3mgp.qgs.abigail@alexandra.abigail.nl>

Brendon Caligari (bcaligari@nospam.fireforged.com) wrote on MMMMLII
September MCMXCIII in <URL:news:4161d09b$0$94914$bed64819@news.gradwell.net>:
;;  I cannot understand what i'm doing wrong but my script fails to compile 
;;  ("panic: end_shift");

Probably a syntax error that is triggering a bug in Perl. You should
never get the "panic" message - if you get it, it's a bug in Perl.

Probably the most common source of such 'panic' errors happen when
Perl tries to compile a regexp containing some kind of syntax error.

;;  $SMContents =~ m/^User data: '(.{$SMMessageLength})'$/ms

Since we don't know what's in $SMMessageLength, it's hard to say
what is going wrong.



Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


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

Date: Tue, 05 Oct 2004 00:37:13 +0000
From: Brendon Caligari <bcaligari@nospam.fireforged.com>
Subject: Re: regex error
Message-Id: <4161ecbb$0$94923$bed64819@news.gradwell.net>

Abigail wrote:

> Brendon Caligari (bcaligari@nospam.fireforged.com) wrote on MMMMLII
> September MCMXCIII in <URL:news:4161d09b$0$94914$bed64819@news.gradwell.net>:
> ;;  I cannot understand what i'm doing wrong but my script fails to compile 
> ;;  ("panic: end_shift");
> 
> Probably a syntax error that is triggering a bug in Perl. You should
> never get the "panic" message - if you get it, it's a bug in Perl.
> 
> Probably the most common source of such 'panic' errors happen when
> Perl tries to compile a regexp containing some kind of syntax error.
> 
> ;;  $SMContents =~ m/^User data: '(.{$SMMessageLength})'$/ms
> 
> Since we don't know what's in $SMMessageLength, it's hard to say
> what is going wrong.
> 
> 
> 
> Abigail

Thanks Abigail...


<cut filename = 'x.pl'>
#!/usr/bin/perl
use warnings;
use strict;

my $str = '';
my $num = 0;
open(MF, "<x");
{
         local $/ = '';
         $str = <MF>;
}
close(MF);
$str =~ m/^length: (\d+?)$/ms;
$num = $1;
$str =~ m/^data: '(.{$num})'$/ms;
</cut>


<cut filename = 'x'>
length: 5
data: '01234'
</cut>


$ uname -r
2.4.21-20.EL


$ rpm -q perl
perl-5.8.0-88.7



I tried the same thing on a WinXP machine with a recentish version of 
ActivePerl port and it worked well.


Brendon


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

Date: 4 Oct 2004 14:10:17 -0700
From: dutone@hotmail.com (dutone)
Subject: Re: removing empty split() fields
Message-Id: <7d56a4da.0410041310.180c85f0@posting.google.com>

Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrnclun29.2hj.tadmc@magna.augustmail.com>...
> dutone <dutone@hotmail.com> wrote:
> > Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrncls0n6.20i.tadmc@magna.augustmail.com>...
> >> dutone <dutone@hotmail.com> wrote:
> >> > sample file:
> >> >  +123n
> >> > blah blah blah
> >> > +123+
> >> > more blah
> 
> [snip]
> 
> > In my sample file '+123' is the first line, no
> > spaces , tabs etc...  above it.
> 
> 
> That isn't what was in the sample file that you showed to us.
> 
> In our data there _is_ a space in the first field.

   oops, sorry.
> 
> Please post a short and complete program that *we can run*
> that illustrates the problem you are trying to solve.
> 

   the question is why there is an extra field in my array when I
split the above listed file (no starting space) on the given delim.

> Do you know how to use the __DATA__ token to include file contents
> in your source code file?

  yes, but not good for this.   
> (If not, have you seen the Posting Guidelines that are posted here frequently?)


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

Date: Tue, 05 Oct 2004 00:41:05 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: removing empty split() fields
Message-Id: <2se1u0F1j9cudU1@uni-berlin.de>

dutone wrote:
> Tad McClellan wrote:
>> 
> 
> the question is why there is an extra field in my array when I
> split the above listed file (no starting space) on the given delim.

The extract from "perldoc -f split", that I posted in this thread a
couple of days ago, explains it.

>> Do you know how to use the __DATA__ token to include file
>> contents in your source code file?
> 
> yes, but not good for this.

Why not?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 4 Oct 2004 19:16:36 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: removing empty split() fields
Message-Id: <slrncm3pv4.1uq.tadmc@magna.augustmail.com>

dutone <dutone@hotmail.com> wrote:
> Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrnclun29.2hj.tadmc@magna.augustmail.com>...
>> dutone <dutone@hotmail.com> wrote:
>> > Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrncls0n6.20i.tadmc@magna.augustmail.com>...
>> >> dutone <dutone@hotmail.com> wrote:
>> >> > sample file:
>> >> >  +123n
>> >> > blah blah blah
>> >> > +123+
>> >> > more blah
>> 
>> [snip]
>> 
>> > In my sample file '+123' is the first line, no
>> > spaces , tabs etc...  above it.
>> 
>> 
>> That isn't what was in the sample file that you showed to us.
>> 
>> In our data there _is_ a space in the first field.
> 
>    oops, sorry.


If you had provided a short and complete program, as suggested in
the Posting Guidelines, you wouldn't be needing to apologize now.

If you had used copy/paste on the output, as suggested in
the Posting Guidelines, you wouldn't be needing to apologize now.


>> Please post a short and complete program that *we can run*
>> that illustrates the problem you are trying to solve.


 ... and we *still* have not seen one of those.

Are you there? Are you listening?

If you do what has been asked, you are *guaranteed* that someone
will be able to answer the question...


>    the question is why there is an extra field in my array when I
> split the above listed file (no starting space) on the given delim.


If you had _said_ what you expected instead of what you were getting,
as suggested in the Posting Guidelines, then we might have answered
he right question rather than the wrong question.

The output you showed is exactly the expected behavior, which leaves
us all guessing as to what you want to be different.

When I asked if your problem was the extra spaces at the beginning
of the lines after the first one, you said yes.

But now you are saying that you have some _other_ question.

Does "yes" mean something different when you say it?


>> Do you know how to use the __DATA__ token to include file contents
>> in your source code file?
> 
>   yes, but not good for this.   


No, it is very good for this. It would have saved you from wasting the
time of hundreds of people around the world!

Why do you think it is not good for "this"?


>> (If not, have you seen the Posting Guidelines that are posted here frequently?)


The Posting Guidelines were written to help those that cared to avoid
becoming killfiled.

People that don't follow them risk getting a

   *plonk*


You have used up all of your coupons with this one poorly-stated
problem, so long.




[ But since I am here, and you have *finally* made clear what you
  want, here is how you can avoid capturing the initial field:

  my(undef, @splitData) = split /\+123(?:\+)?/, "@data";   

]

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 4 Oct 2004 17:50:37 -0700
From: William Ahern <william@wilbur.25thandClement.com>
Subject: Signal handling and modules
Message-Id: <tn7932-8qh.ln1@wilbur.25thandClement.com>

If I set a signal handler in Perl which does *not* die()--just simply
returns--will Perl still longjmp()? I suspect not, but I want to be sure. My
Problem is that I'm using a large C module which could get very confused if
Perl longjmp()d out of its execution path (deadlock, for instance). However,
I still want to set an alarm. The C code will fail properly when a blocking
call interrupts.

TIA,

Bill


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

Date: 04 Oct 2004 16:53:03 GMT
From: ctcgag@hotmail.com
Subject: Re: Two write to a file with flock, what will happen?
Message-Id: <20041004125303.117$Ct@newsreader.com>

"http://www-free.info" <aa@bb.cc> wrote:
> Will the second process wait for the first one to finish?
>
> If so, for how long or how many tries?

If a rooster lays an egg on the north side of a pitched roof, which
way will the egg roll?

Nowhere, roosters don't lay eggs.  And flock doesn't write to files.

If you want us to predict what a (small) piece of code does, you have to
show us the code.

Xho

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


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

Date: 4 Oct 2004 13:17:56 -0700
From: pengxiang_zhou@yahoo.com (perry zhou)
Subject: use sed in perl
Message-Id: <4204c44b.0410041217.55ea5b36@posting.google.com>

I used some legacy perl code to change a configuration file, it is
working and it replaces the line starts with XT_SCREEN_COUNT=1 with
the a new SCREEN_COUNT variable.  But I don't quite understand what's
the meaning of the ' . in front of $numscreens and after $numscreens.
Could anyone give me a hint?

Thanks in advance!

$rc = system('sed -e
"s/^XT_SCREEN_COUNT=1/XT_SCREEN_COUNT='.$numscreens. '/g" '.
$resultdir.'tetexec.cfg>' .  $resultdir. 'tetexec.cfg.tmp');

$numscreens is a variable which equals to a number, for example 2. 
=======================================================================
#Part of the configuration file:
 
# available on the display, as returned by XScreenCount.
# the code above will change the 1 to 2.
XT_SCREEN_COUNT=1


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

Date: 04 Oct 2004 20:39:43 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: use sed in perl
Message-Id: <slrncm3d8f.qgs.abigail@alexandra.abigail.nl>

perry zhou (pengxiang_zhou@yahoo.com) wrote on MMMMLII September MCMXCIII
in <URL:news:4204c44b.0410041217.55ea5b36@posting.google.com>:
**  I used some legacy perl code to change a configuration file, it is
**  working and it replaces the line starts with XT_SCREEN_COUNT=1 with
**  the a new SCREEN_COUNT variable.  But I don't quite understand what's
**  the meaning of the ' . in front of $numscreens and after $numscreens.
**  Could anyone give me a hint?

The dot is the concatenation operator. See the perlop manual page.


Abigail
-- 
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: Mon, 04 Oct 2004 18:20:34 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Version?  Getopt::Long
Message-Id: <Svg8d.1$Ua.0@trndny04>

"Mark J Fenbers" <Mark.Fenbers@noaa.gov> wrote in message
news:41618FD8.BE7DD0BC@noaa.gov...
> I'm giving tech support to someone and suspect his version of
> GetOpt::Long is older than mine.  What simple test can be given on the
> command-line to determine what version is being used on his computer?
> Perhaps something like:
>
> perl -MAppConfig -e' print_version()'
>
> or something along those lines...
>

The canonical way is:

perl -MGetopt::Long -e 'print $Getopt::Long::VERSION'

Of course, that would depend upon the author of this module following
the convention of creating a package variable $VERSION with the
appropriate information.

Paul Lalli




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

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 7208
***************************************


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