[19848] in Perl-Users-Digest
Perl-Users Digest, Issue: 2043 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 31 14:11:01 2001
Date: Wed, 31 Oct 2001 11:10:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1004555415-v10-i2043@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 31 Oct 2001 Volume: 10 Number: 2043
Today's topics:
how to split . <a246456@fmr.com>
Re: how to split . <jurgenex@hotmail.com>
Re: how to split . (John J. Trammell)
Re: how to split . (Jason Kawaja)
Re: how to split . a246456@fmr.com
Re: how to split . (Tad McClellan)
Re: how to split . <mjcarman@home.com>
Is \n\n safe for http? <rihad@mail.ru>
Re: Is \n\n safe for http? <bart.lateur@skynet.be>
Re: Is \n\n safe for http? (Rafael Garcia-Suarez)
Re: Is \n\n safe for http? <flavell@mail.cern.ch>
Re: Is \n\n safe for http? <comdog@panix.com>
Re: Is \n\n safe for http? <comdog@panix.com>
Re: Is \n\n safe for http? nobull@mail.com
Re: Linking Perl to a databse <nobody@nowhere.com>
Re: ms-word doc's & perl <peter_icaza@REMOVE2REPLYuhc.com>
Perl and Recursion: HELP!!! (Shahab Ahmed)
Re: Perl and Recursion: HELP!!! <mjcarman@home.com>
perl/Apache/SSL problem <mark@tamar.co.uk>
Re: Ping Script Help Needed <lhswartw@ichips.intel.com>
Question on regExp and Escape Sequences <w_oden@hotmail.com>
Re: Question on regExp and Escape Sequences <simon.oliver@umist.ac.uk>
Re: Question on regExp and Escape Sequences <Laocoon@eudoramail.com>
returning arrays (M.A. Oxby)
Re: returning arrays <Laocoon@eudoramail.com>
Re: when does 0.58 != 0.58? <jurgenex@hotmail.com>
Re: when does 0.58 != 0.58? <nospam-abuse@ilyaz.org>
Re: Win32 port of PerlTK (Richard Williams)
Re: Wrapping long emails - sample code (Philip S Tellis)
Re: XML parsing (Robin Berjon)
Re: XSL Processor <nospam@nospam.com>
Re: Yet another regexp question <BROWNHIK@Syntegra.Bt.Co.Uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 30 Oct 2001 16:16:54 -0500
From: Narendra Pavuluri <a246456@fmr.com>
Subject: how to split .
Message-Id: <3BDF18C6.824F679C@fmr.com>
I am trying to split with "." it does`nt work. Can you tell me why...
for example: $hostname= weblogic.monster.com
($host,$domain,$com)=split(".",$hostname);
Is . a special character.....
Thanks in advance....
------------------------------
Date: Wed, 31 Oct 2001 08:29:13 -0800
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: how to split .
Message-Id: <3be026f0@news.microsoft.com>
"Narendra Pavuluri" <a246456@fmr.com> wrote in message
news:3BDF18C6.824F679C@fmr.com...
> I am trying to split with "." it does`nt work. Can you tell me why...
>
> for example: $hostname= weblogic.monster.com
> ($host,$domain,$com)=split(".",$hostname);
The first argument to split is interpreted as a pattern, i.e. a RegExp.
> Is . a special character.....
Yes. As in any RE you need to escape it. And probably better use the
familiar slashes instead of quotes to emphasize that you are dealing with
REs, not with strings:
($host,$domain,$com)=split(/\./,$hostname);
jue
------------------------------
Date: Wed, 31 Oct 2001 09:41:09 -0600
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: how to split .
Message-Id: <slrn9u09n4.ill.trammell@haqq.el-swifto.com>
On Tue, 30 Oct 2001 16:16:54 -0500, Narendra Pavuluri <a246456@fmr.com> wrote:
> I am trying to split with "." it does`nt work. Can you tell me why...
>
> for example: $hostname= weblogic.monster.com
> ($host,$domain,$com)=split(".",$hostname);
>
> Is . a special character.....
Yes, it is.
my ($host,$domain,$com) = split(/\./,$hostname);
--
[W]hen the manager knows his boss will accept status reports without
panic or preeemption, he comes to give honest appraisals.
- F. Brooks, _The Mythical Man-Month_
------------------------------
Date: Wed, 31 Oct 2001 16:29:57 +0000 (UTC)
From: kawaja@ece.ufl.edu (Jason Kawaja)
Subject: Re: how to split .
Message-Id: <slrn9u09or.nm2.kawaja@kawaja.ece.ufl.edu>
previously, Narendra Pavuluri <a246456@fmr.com> wrote:
> I am trying to split with "." it does`nt work. Can you tell me why...
>
> for example: $hostname= weblogic.monster.com
> ($host,$domain,$com)=split(".",$hostname);
>
> Is . a special character.....
yes.
split(/\./,$hostname);
--
/* Regards,
Jason Kawaja, UF-ECE Sys Admin */
------------------------------
Date: Wed, 31 Oct 2001 10:45:15 -0500
From: a246456@fmr.com
Subject: Re: how to split .
Message-Id: <3BE01C8B.D41A27BD@fmr.com>
It works...
($host,$domain,$com)=split(/\./,$hostname);
Narendra Pavuluri wrote:
> I am trying to split with "." it does`nt work. Can you tell me why...
>
> for example: $hostname= weblogic.monster.com
> ($host,$domain,$com)=split(".",$hostname);
>
> Is . a special character.....
> Thanks in advance....
------------------------------
Date: Wed, 31 Oct 2001 17:03:08 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: how to split .
Message-Id: <slrn9u08i9.3sp.tadmc@tadmc26.august.net>
Narendra Pavuluri <a246456@fmr.com> wrote:
>I am trying to split with "." it does`nt work. Can you tell me why...
>Is . a special character.....
You already know why!
You can put a backslash character before it to remove its "specialness".
And a pattern match should *look like* a pattern match: /\./
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 31 Oct 2001 10:30:00 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: how to split .
Message-Id: <3BE02708.3B3DC253@home.com>
Narendra Pavuluri wrote:
>
> I am trying to split with "." it does`nt work. Can you tell me why...
>
> for example: $hostname= weblogic.monster.com
> ($host,$domain,$com)=split(".",$hostname);
>
> Is . a special character.....
Inside a regex[1], yes. You need to escape it to turn it into a literal
dot:
($host,$domain,$com) = split(/\./, $hostname);
[1] The first argument to split() is interpreted as a regex,
regardless of the delimeter you use.
-mjc
------------------------------
Date: Wed, 31 Oct 2001 19:21:40 -0800
From: rihad <rihad@mail.ru>
Subject: Is \n\n safe for http?
Message-Id: <4nf1utk4ekgnbg8kp3sg6amcotq4o9176q@4ax.com>
Hi there.
All of us have no doubt frequently seen the
print "Content-Type: text/html\n\n";
line in perl cgi scripts. But I've been reading rfc2616 (HTTP) and it
says that each header must end in a CRLF sequence which must be
ASCII(13) ASCII(10), and the headers section itself must end in a
CRLF. Is it safe to assume that \n will expand to CRLF??
Either this or I'm dumb.
TIA
--
rihad
------------------------------
Date: Wed, 31 Oct 2001 15:39:17 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Is \n\n safe for http?
Message-Id: <hh60uts3t5c7iahce71k9euop5khbbvqvo@4ax.com>
rihad wrote:
>All of us have no doubt frequently seen the
>print "Content-Type: text/html\n\n";
>line in perl cgi scripts. But I've been reading rfc2616 (HTTP) and it
>says that each header must end in a CRLF sequence which must be
>ASCII(13) ASCII(10), and the headers section itself must end in a
>CRLF. Is it safe to assume that \n will expand to CRLF??
No.
But these are not the HTPP headers. These are the CGI headers. The web
server is still standing between the CGI script and the HTTP client (the
browser). It may add more headers, may even do something else with them
entirely. Anyway, it's this web server that will (or should) turn the
newlines into CRLF's.
--
Bart.
------------------------------
Date: 31 Oct 2001 15:38:04 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Is \n\n safe for http?
Message-Id: <slrn9u06ng.op.rgarciasuarez@rafael.kazibao.net>
rihad wrote in comp.lang.perl.misc:
>
> All of us have no doubt frequently seen the
> print "Content-Type: text/html\n\n";
> line in perl cgi scripts. But I've been reading rfc2616 (HTTP) and it
> says that each header must end in a CRLF sequence which must be
> ASCII(13) ASCII(10), and the headers section itself must end in a
> CRLF. Is it safe to assume that \n will expand to CRLF??
No, \n will not always expand to CRLF. But the webserver _may_ fix this
for you.
Anyway, that's another reason why you should use CGI.pm, that takes
cares of defining an internal $CRLF variable in a portable way.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Wed, 31 Oct 2001 16:49:07 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Is \n\n safe for http?
Message-Id: <Pine.LNX.4.30.0110311632150.27408-100000@lxplus023.cern.ch>
On Oct 31, rihad inscribed on the eternal scroll:
> All of us have no doubt frequently seen the
> print "Content-Type: text/html\n\n";
> line in perl cgi scripts.
Correct. See the CGI specification. The Perl FAQ part 9 will also
clarify this, when the documentation patch which is already in the
development tree gets distributed. (The regulars around here know
that I had been complaining about certain parts of the old perlfaq9
for some years already, and I was glad to see that something finally
happened...)
>But I've been reading rfc2616 (HTTP) and it
> says that each header must end in a CRLF sequence which must be
> ASCII(13) ASCII(10),
Correct. That is the HTTP interworking specification, not the CGI
specification. The similarities are of course intentional, but
sometimes this causes confusion - as indeed seems to be happening
here.
> Is it safe to assume that \n will expand to CRLF??
It should be safe to assume that the HTTPD (server) will accept a CGI
response conforming to the CGI specification, and, on the basis of
that response, will produce an HTTP response conforming to the HTTP
specification, yes.
If that's not so, then the server does not conform to the respective
specifications. There are said to be such servers in existence (if
so, then naturally I would recommend upgrading to Apache ;-)
all the best
------------------------------
Date: Wed, 31 Oct 2001 12:26:32 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: Is \n\n safe for http?
Message-Id: <comdog-40B788.12263231102001@news.panix.com>
In article
<Pine.LNX.4.30.0110311632150.27408-100000@lxplus023.cern.ch>, "Alan J.
Flavell" <flavell@mail.cern.ch> wrote:
> On Oct 31, rihad inscribed on the eternal scroll:
> > All of us have no doubt frequently seen the
> > print "Content-Type: text/html\n\n";
> > line in perl cgi scripts.
> Correct. See the CGI specification. The Perl FAQ part 9 will also
> clarify this, when the documentation patch which is already in the
> development tree gets distributed.
if you can't wait, then you can look at the CVS tree for Alan's
complete answer:
http://cvs.perl.org/cvsweb/perlfaq/perlfaq9.pod
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Wed, 31 Oct 2001 12:33:48 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: Is \n\n safe for http?
Message-Id: <comdog-3A89AA.12334831102001@news.panix.com>
In article <slrn9u06ng.op.rgarciasuarez@rafael.kazibao.net>,
rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> rihad wrote in comp.lang.perl.misc:
> >
> > All of us have no doubt frequently seen the
> > print "Content-Type: text/html\n\n";
> > line in perl cgi scripts. But I've been reading rfc2616 (HTTP) and it
> > says that each header must end in a CRLF sequence which must be
> > ASCII(13) ASCII(10), and the headers section itself must end in a
> > CRLF. Is it safe to assume that \n will expand to CRLF??
> No, \n will not always expand to CRLF. But the webserver _may_ fix this
> for you.
the CGI specification uses _MUST_ for this.
http://CGI-Spec.Golux.Com/draft-coar-cgi-v11-03-clean.html#8.1.4
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: 31 Oct 2001 18:31:47 +0000
From: nobull@mail.com
Subject: Re: Is \n\n safe for http?
Message-Id: <u94rofvey4.fsf@wcl-l.bham.ac.uk>
rihad <rihad@mail.ru> writes:
> print "Content-Type: text/html\n\n";
> line in perl cgi scripts. But I've been reading rfc2616 (HTTP) and it
> says that each header must end in a CRLF sequence which must be
> ASCII(13) ASCII(10), and the headers section itself must end in a
> CRLF.
'CGI' ne 'HTTP'
For HTTP the end-of-line is defined to be CRLF.
For CGI is parsed header mode it can be CR, LF, or CRLF.
I believe that a CGI script operating in non-parsed-header mode (NPH)
emits raw HTTP so in this case the headers must be CRLF terminated.
> Is it safe to assume that \n will expand to CRLF??
In parsed header mode with an HTTP server that conforms to the draft
CGI/1.1 specification yes:
The server MUST translate the header data from the CGI header field
syntax to the HTTP header field syntax if these differ. For example,
the character sequence for newline (such as Unix's ASCII NL) used by
CGI scripts may not be the same as that used by HTTP (ASCII CR
followed by LF).
Of course this is still only a draft, but the stated goal of the
specification is to 'Clearly and concisely codify "current practice"
of CGI/1.1 usage on the Web as of 2000' so it is reasonable to assume
that the specification isn't going to require behaviour of an HTTP
server that isn't current practice.
This, of course, has nothing to do with Perl.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 1 Nov 2001 04:50:52 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: Linking Perl to a databse
Message-Id: <KHXD7.724$lh4.7855@newsfeeds.bigpond.com>
"Chris Collins" <chris.collins@rbos.com> wrote in message
news:c1b9601c.0110310343.62908c13@posting.google.com...
> I am trying to link a Perl script to a sybase database. I then want
> to run a query and print the results into a seperate file. I am
> confident that i can do this once i have the necesaary material.
> Unfortunately i cannot find anywhere how to access a database. IsJust
about every Into to Perl book ha a >
Just about every Intro to Perl book has a section on databases, You can't be
looking too hard.
See http://www.oreilly.com/catalog/perldbi/chapter/ch04.html
gtoomey
------------------------------
Date: Wed, 31 Oct 2001 11:27:10 -0500
From: peter <peter_icaza@REMOVE2REPLYuhc.com>
Subject: Re: ms-word doc's & perl
Message-Id: <3BE0265E.A8DC594B@REMOVE2REPLYuhc.com>
> Figure out what you want to automate, record a macro in Word (WARNING:
> VB here), then translate it into Perl using Win32::OLE to run M$Word.
> It's not all that hard, particularly if you just want to insert
> words/phrases at specific points from a database or other text file.
this looks like what i want to do. alas, i'm a UNIX guy with no knowledge of
vb, m$-woid macros or perl on m$ and they dont allow freeware here on the
pc's and i probably wont be "allowed" to pursue this...but i will try :)
thanks,
peter
>
>
>
------------------------------
Date: 31 Oct 2001 07:27:22 -0800
From: sahmed@msai.mea.com (Shahab Ahmed)
Subject: Perl and Recursion: HELP!!!
Message-Id: <696cbc0a.0110310727.2cb40ba2@posting.google.com>
Hi folks:
I thought I would seek some professional help before I go nuts! (don't
get me wrong, I love being a nut!).
I am writing a program to traverse a tree structure. Its basically a
bunch of
segments specified one segment in one line. So, each segment has head
x1, y1 and
tail x2, y2 co-ordinates. The segments are not listed in any order in
the file.
I know the starting point of the tree. Would any kind soul be patient
enough to take a look at the code I have written and see where I am
doing wrong?
#!/usr/local/bin/perl
$input_file = "test.txt";
open (input, "$input_file") || die "\n";
$n=0;
while(<input>) {
if ((!/^A/) && (!/^J/)){
@s_line = split(' ',$_);
#find the starting segment. Starting seg is determined by a keyword
FIG_RECT
if (/FIG_RECT/) {$x1 = $s_line[6]; $y1=$s_line[7];
$x2 = $s_line[8]; $y2=$s_line[9];
}else{
##Store x, y cordinates for all segments. x1,y1 is head and x2,y2 is
the tail
# printf "$s_line[1] $s_line[2] $s_line[3] ";
# printf "$s_line[6] $s_line[7] $s_line[8] $s_line[9]\n";
$x1{$n} = $s_line[6]; $y1{$n} = $s_line[7];
$x2{$n} = $s_line[8]; $y2{$n} = $s_line[9];
printf "$n $x1{$n} $y1{$n} $x2{$n} $y2{$n}\n";
}
$n++;
}
}
#initialize variables used in the subroutine build_path.
$total_seg_visited=0;
for ($k=0;$k<$n; $k++) {
$visited{$k} = 0;
}
&build_path($x2, $y2); # initial x2, y2 is the tail cordinate for
the
# starting segment.
sub build_path {
my($x2, $y2) =@_;
my($k,$branchx2, $branchy2, $branch);
#printf "N is $n\; x2 \= $x2\; y2 \= $y2\n";
while ($total_seg_visited <($n-1)) {
## 1. In this for loop, tail of a line is checked head of all lines.
## 2. for matched segments, branch is a counter. It counts how many
branches
## were found. It also stores the branch's x2, and y2 co-ordinates.
for ($k=0;$k<$n; $k++) {
# printf "$k x2 \= $x2 y2 \= $y2";
# printf " x1 \= $x1{$k} y1 \= $y1{$k}\n";
if (($visited{$k}==0) && ($x2 ==$x1{$k}) &&($y2==$y1{$k})) {
$visited{$k}=1; $total_seg_visited++; $branch++; #****
$branchx2{$branch} = $x2{$k};
$branchy2{$branch} = $y2{$k};
printf "match found at line $k\n";
printf "total branches $branch $branchx2{$branch}
$branchy2{$branch}\n";
}#if closed.
}#for loop closed.
#printf "$branch\n";
if ($branch==1) {
$x2 = $branchx2{$branch}; $y2 = $branchy2{$branch};
$branch=0;
}elsif ($branch >1) {
for ($m=0; $m<$branch; $m++) {
$x2 = $branchx2{$branch}; $y2 = $branchy2{$branch};
printf "starting branch $x2 $y2\n";
printf "visited nets: $total_seg_visited\n";
return build_path($x2, $y2);
}#for loop closed.
$branch=0;
}#if block ended.
}#while loop closed.
}#end function
Thank you for help.
Regards,
Shahab
------------------------------
Date: Wed, 31 Oct 2001 10:08:53 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Perl and Recursion: HELP!!!
Message-Id: <3BE02215.491F22B7@home.com>
Shahab Ahmed wrote:
>
> I thought I would seek some professional help before I go nuts!
Small wonder. Your algorithm is hopelessly tangled. Structurally, it
looks like this:
my ($x, $y) = (0, 10);
foo();
sub foo {
while ($x < $y) {
$x++
return foo();
}
}
So you're trying to recurse from inside a while() loop which is
controlled by parameters outside of the subroutine itself... Very messy.
Makes my head hurt just thinking about what it's going to do.
I think you need an all-new algorithm. :/ If you can provide some sample
data and expected output, we should be able to help.
-mjc
------------------------------
Date: Wed, 31 Oct 2001 15:20:57 -0000
From: "Mark Bathie" <mark@tamar.co.uk>
Subject: perl/Apache/SSL problem
Message-Id: <1004545227.794010@adsl.fast.net.uk>
Hi all,
I know this isn't the most appropriate news group for this kind of problem
but I have a really annoying problem with a web site written in perl.
Ever since installing SSL on our apache web server we have been getting
random "page not found" errors when viewing an encrypted page. Almost as if
the web server is not there at all. However, upon refreshing the null page
it does often work. It is because this problem is completely randon that I
can't fingure it out.
Some possibilities:
1) seams to only happen under IE5.0
2) possibly only under browsers with 56-bit strength encryption
has anyone had this problem before ? any clues ? can anyone shed some light
?
cheers
Mark Bathie.
------------------------------
Date: Wed, 31 Oct 2001 10:12:42 -0800
From: "Swanthog" <lhswartw@ichips.intel.com>
Subject: Re: Ping Script Help Needed
Message-Id: <9rpeuq$ojb@news.or.intel.com>
Alex,
You could simply say:
if( $retval)
{
$Response->Redirect("pingresult.asp?Error=No");
} else {
$Response->Redirect("pingresult.asp?Error=Yes");
}
Another alternative is:
if( ! $retval)
{
$Response->Redirect("pingresult.asp?Error=Yes");
} else {
$Response->Redirect("pingresult.asp?Error=No");
}
Larry S.
"Alex Davidson" <alexd@NOSPAMsynergycsi.com> wrote in message
news:9r9bh6$id3@dispatch.concentric.net...
> I have the following script in a page in order for me to determine an IP
> being available so I can use an alternate site if necessary:
>
> <SCRIPT LANGUAGE="PerlScript" RUNAT="Server">
> use Net::Ping;
> $host = "216.98.200.32";
> $p = Net::Ping->new();
> $retval = $p->ping($host,1);
> $p->close();
> if ($retval = 0) {
> $Response->Redirect("pingresult.asp?Error=Yes");
> } else {
> $Response->Redirect("pingresult.asp?Error=No");
> }
> </SCRIPT>
>
> 216.98.200.32 comes back as "Destination specified is invalid" when I PING
> it yet this script returns no error.
>
> I have tried:
> if ($retval = "0") {
> if ($retval == "0") {
> if ($retval == 0) {
>
> with similar results (bad and good IPs both show either good or bad) - I
> can't find the syntax to discriminate correctly between reachable and
> unreachable IPs.
>
> As you can tell I am a complete neophyte and not sure of the syntax to
use.
>
> Can someone correct it for me?
>
> Thanks.
>
>
------------------------------
Date: Wed, 31 Oct 2001 16:26:29 GMT
From: WODEN <w_oden@hotmail.com>
Subject: Question on regExp and Escape Sequences
Message-Id: <l390utg3ovq49dnomm5seb6q0rm3jb7dld@4ax.com>
Hi, I am fairly new to perl, and let me say, what a trip. Anyway, I
am trying to write a script that will go through a text file and
replace one path with another, ie, if it finds c:\tmp, it will replace
it with c:\notTemp. I am having a very weird problem. I wrote the
following script to narrow down the problem:
#!perl -w
#This script should reporduce the error I saw in my perl script
#
my $stringToFix = "E:\\JuiceMain2\\source\\server";
my %settings;
$settings{BUILDMACHINE_JUICE_ROOT} = 'E:\\JuiceMain2';
$settings{JUICE_ROOT} = "c:\\projects\\main2";
print "$settings{BUILDMACHINE_JUICE_ROOT}\n";
$stringToFix =~
s/$settings{BUILDMACHINE_JUICE_ROOT}/$settings{JUICE_ROOT}/gi;
print "**$stringToFix\n**";
this is the output I am getting:
e:\ntestE:\JuiceMain2
Unrecognized escape \J passed through before HERE mark in regex m/E:\J
<< HERE uiceMain2/ at
C:\Projects\Acropole-users\Users\jharris\Perl\Learning Perl\rxError.pl
line 11.
**E:\JuiceMain2\source\server
**
========== [C:\Projects\Acropole-users\Users\jharris\Perl\Learning
Perl\rxError.pl] run finished. ==========
I see what is happening, the \\ in my string (the one in the regExp,
is getting evaluated before the regExp, so the regExp is actually
seeing E:\JuiceMain2, which has the escape char \J. So the question
is, how do I fix it? what is the correct thing to do,
Thanks
-Woden
PS
I got around it by converting \\ to / and then after the regexp, I
converted the / back to \\, but this seems tedious and stupid
------------------------------
Date: Wed, 31 Oct 2001 16:31:23 +0000
From: Simon Oliver <simon.oliver@umist.ac.uk>
To: WODEN <w_oden@hotmail.com>
Subject: Re: Question on regExp and Escape Sequences
Message-Id: <3BE0275B.B8F6FF56@umist.ac.uk>
> $settings{BUILDMACHINE_JUICE_ROOT} = 'E:\\JuiceMain2';
^
You escaped the J because the string was in single quotes.
You should have one of these:
$settings{BUILDMACHINE_JUICE_ROOT} = 'E:\JuiceMain2';
$settings{BUILDMACHINE_JUICE_ROOT} = "E:\\JuiceMain2";
--
Simon Oliver
------------------------------
Date: Wed, 31 Oct 2001 17:38:44 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Question on regExp and Escape Sequences
Message-Id: <Xns914BB380F27F2Laocooneudoramailcom@62.153.159.134>
*snip*
> $stringToFix =~
> s/$settings{BUILDMACHINE_JUICE_ROOT}/$settings{JUICE_ROOT}/gi;
s/\Q$settings{BUILDMACHINE_JUICE_ROOT}\E/$settings{JUICE_ROOT}/gi
\Q disables quoting till \E
> print "**$stringToFix\n**";
>
>
>
> this is the output I am getting:
>
> e:\ntestE:\JuiceMain2
> Unrecognized escape \J passed through before HERE mark in regex m/E:\J
> << HERE uiceMain2/ at
> C:\Projects\Acropole-users\Users\jharris\Perl\Learning Perl\rxError.pl
> line 11.
> **E:\JuiceMain2\source\server
> **
*snip*
perldoc perlre
Hope this helps you..
Lao
------------------------------
Date: Wed, 31 Oct 2001 17:31:16 GMT
From: JHM1MAO@leeds.ac.uk (M.A. Oxby)
Subject: returning arrays
Message-Id: <GM2zBv.Dtt@leeds.ac.uk>
Keywords: arrays, array
Okay then, so it seems we have a disagreement. If one can return an array
successfull froma sub, would someone mind letting me in on the secret as I
failed to do this the other day? :-)
Thankee
- Martin Oxby
Founder and Administrator
[http://www.resource-centre.net]
Web Resources, Free Email, Messaging and Programming Tutorials all under one roof!
------------------------------
Date: Wed, 31 Oct 2001 18:43:24 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: returning arrays
Message-Id: <Xns914BBE7724A24Laocooneudoramailcom@62.153.159.134>
References
perldoc perlref
------------------------------
Date: Wed, 31 Oct 2001 08:10:49 -0800
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: when does 0.58 != 0.58?
Message-Id: <3be02294@news.microsoft.com>
"Paul Boardman" <peb@bms.umist.ac.uk> wrote in message
news:3BDFD418.371FED9F@bms.umist.ac.uk...
> Problem is that a comparison of my variable with 0.58 is false, even
> when the variable is 0.58.
You forgot the first commandment of numerical computation:
Thou shalt not test floating point numbers for equality.
Either use integers (compare 58 to a variable containing 58) or test if the
value of the variable is within an epsilon range of .58.
BTW: this is a FAQ, see "perldoc -q number"
BTW2: I wonder if there is a Perl module for symbolic arithmetic.
jue
------------------------------
Date: Wed, 31 Oct 2001 16:22:00 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: when does 0.58 != 0.58?
Message-Id: <9rp8f8$9ge$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Bart Lateur
<bart.lateur@skynet.be>], who wrote in article <udlvttoh7k1e77dii212913j1dn3vmvda2@4ax.com>:
> Paul Boardman wrote:
>
> >Problem is that a comparison of my variable with 0.58 is false, even
> >when the variable is 0.58.
> >
> >Here's a little code to clarify :-
>
> >perl -MDevel::Peek -le 'for(my $a = 0.56; $a < 0.60; $a += 0.02){print
> >"\nComparing ";Dump $a;print "with 0.56\n";if($a == 0.56){print "They
> >are the same!"}else{print "They are different!"}}'
>
> See the FAQ, perlfaq4 (top of document):
>
> Why am I getting long decimals (eg, 19.9499999999999) instead of the
> numbers I should be getting (eg, 19.95)?
The actual problem is that do_svdump() (or whatever) is using a wrong
format to printing NV. In this case one should increase the sprintf()
precision w.r.t. the Perl's default "hide minor discrepancies" value.
Please report as a bug.
Ilya
------------------------------
Date: Wed, 31 Oct 2001 14:52:44 +0000 (UTC)
From: rdwillia@hgmp.mrc.ac.uk (Richard Williams)
Subject: Re: Win32 port of PerlTK
Message-Id: <9rp37s$rv7$1@niobium.hgmp.mrc.ac.uk>
In article <3BDE549F.BFFA7ACC@no-spam-what-so-ever.se.abb.com>,
Mika Morell <mika.morell@no-spam-what-so-ever.se.abb.com> wrote:
>Is there anyone who knwos where to get a binary package of Perl/TK for
>Win32. I am having trouble to compile the sourcecode since i am using
>djgpp and gcc.
If you are using Activestate's Perl, you can download and install
a suitable module using the PPM package manager, as described in their
docs:
http://aspn.activestate.com/ASPN/Reference/Products/ASPNTOC-ACTIVEPERL
See especially their FAQ:
http://aspn.activestate.com/ASPN/Reference/Products/ASPNTOC-ACTIVEPERL-001-005
This information is also in the Activeperl docs that come with the
distribution.
Richard.
------------------------------
Date: 31 Oct 2001 11:00:28 -0800
From: philip@ncst.ernet.in (Philip S Tellis)
Subject: Re: Wrapping long emails - sample code
Message-Id: <d1eff1dd.0110311100.24f2ecba@posting.google.com>
> >
> > s/^((?:[>}|%]\s?)+)(\s*)//o;
> ^^^
> Why the 'o' option?
Since the code runs with -p, it basically loops through every line
of the input. The /o will compile the regex the first time, making
it faster to run through subsequent iterations. It makes a
difference on very large input.
Philip
------------------------------
Date: 31 Oct 2001 06:26:15 -0800
From: robin@knowscape.com (Robin Berjon)
Subject: Re: XML parsing
Message-Id: <fdee9f18.0110310626.288b3c44@posting.google.com>
clintp@geeksalad.org (Clinton A. Pierce) wrote in message
> For chrissakkes: it's just text processing. I thought Perl was supposed
> to make this stuff easy.
That's where you get it blantantly wrong. XML isn't about text
processing, it's about structure. The fact that the canonical storage
format happens to be textual is just for convenience. When you're
dealing with XML in an application, you're not handling strings.
If you want text processing go see CSV.
> [1] "So what I can have namespaces and Unicode tag names? This all-singing-
> all-dancing piece of crap makes parsing 7-bit ASCII XML HARD!" Is a typical
> post-CPAN bitch about XML modules.
I don't think the world cares much for your culturo-centricity.
> [2] The AxKit developers owe me two weeks of my life. After jumping through
> all of the hoops to get it installed, I find out that a major component they
> sold me on was based on something that hadn't quite been released from another
> package entirely (gnome?). Bastards. Ah, well, I'd probably have wasted those
> two weeks anyway. PS: They're STILL not ready for primetime.
Hmmmm, tell me, is that an abstract from your FUD PhD ? AxKit's very
ready for primetime, it's running and working fine thank you very
much.
------------------------------
Date: Wed, 31 Oct 2001 16:55:17 GMT
From: "Zoom Zoom Zoom" <nospam@nospam.com>
Subject: Re: XSL Processor
Message-Id: <V1WD7.1420$wj5.689566@news1.rdc1.sfba.home.com>
Excellent!! Thanks, Matt! It worked.
Going forward, I will certainly now post on clp.misc
Thanks, Zoom
"Matt Sergeant" <msergeant@star.net.uk> wrote in message
news:eb3031b9.0110310231.7e82b44@posting.google.com...
> "Zoom Zoom Zoom" <nospam@nospam.com> wrote in message
news:<E7BD7.90686$gT6.47754411@news1.rdc1.sfba.home.com>...
> > I am using ActiveState Perl on Win2K Server. I can't find this package
using
> > ppm If I do search xml, it does not show XSL:LibXSLT I did download
> > XML::Xalan from cpan.org but looks like even it needs to be "build". I
want
> > to know if there are just plain binaries available for any of these
modules?
>
> C:\> ppm
> ppm> set repository RK http://theoryx5.uwinnipeg.ca/ppmpackages/
> ppm> set save
> ppm> install XML::LibXML
> ppm> install XML::LibXSLT
>
> PS: you shouldn't post to c.l.perl - it's supposed to be defunct.
> Please use c.l.p.misc instead. I'd set followups, but you can't via
> google groups.
------------------------------
Date: Wed, 31 Oct 2001 14:12:48 -0000
From: "Kevin Brownhill" <BROWNHIK@Syntegra.Bt.Co.Uk>
Subject: Re: Yet another regexp question
Message-Id: <9rp13m$ib5$1@pheidippides.axion.bt.co.uk>
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:eo00utcs9ro2cln0lrd8sa9npuu8m70o2f@4ax.com...
> Kevin Brownhill wrote:
>
> >I've never seen the point of trying to do everything in one line or the
> >fewest number of characters - as some perl experts seem to do.
Readability
> >is more important in production code which may need to be quickly
understood
> >by other programmers.
> >
> >$str = "BAUGHMAN, KINNEY GRAGG, JACK A GRAGG, MARY LEA W";
> >$term = "GRAGG";
> >($partmatch) = ($str =~ /($term,[^,]+),/);
> >($fullmatch) = ($partmatch =~ /^(.*)\s+\w+$/);
>
> You don't seem to mind not being able to match the last entry on the
> line?
>
> my ($partmatch) = ($str =~ /(\b$term,[^,]+,?)/);
> (my $fullmatch = $partmatch) =~s/\s+\w+,$//;
>
> Try it with
>
> $str = "BAUGHMAN, KINNEY GRAGG, JACK A GREGG, MARY LEA W";
>
> and
>
> for my $term ('GRAGG', 'GREGG') { ... }
>
> --
> Bart.
The easiest solution to this (although not the most elegant) would be
$str = "BAUGHMAN, KINNEY GRAGG, JACK A GRAGG, MARY LEA W";
$str .= " Z,"; # add a final dummy element to the string
$term = "GRAGG";
($partmatch) = ($str =~ /($term,[^,]+),/);
($fullmatch) = ($partmatch =~ /^(.*)\s+\w+$/);
------------------------------
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.
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 2043
***************************************