[19474] in Perl-Users-Digest
Perl-Users Digest, Issue: 1669 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 31 14:05:39 2001
Date: Fri, 31 Aug 2001 11:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <999281111-v10-i1669@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 31 Aug 2001 Volume: 10 Number: 1669
Today's topics:
3D Arrays aka tables <jclover@nati.org>
Re: 3D Arrays aka tables (John J. Trammell)
Re: 3D Arrays aka tables (Mark Jason Dominus)
Re: 3D Arrays aka tables <vmurphy@Cisco.Com>
Re: 3D Arrays aka tables (Malcolm Dew-Jones)
Re: A better way (Ronald Blaschke)
Re: A better way (Rafael Garcia-Suarez)
Re: a perl module dedicated to lists ? nobull@mail.com
Alternations in Parse::RecDescent <weymer@mediawise.de>
Re: Calling sub funcs with scalar variables? nobull@mail.com
Re: Calling sub funcs with scalar variables? nobull@mail.com
Check for valid hex value <davignon@vitesse.com>
Re: Check for valid hex value (Mark Jason Dominus)
Compiling Perl 5.6.1 (Alan Rice)
Re: Dangerous Perl Script? (BUCK NAKED1)
Re: Difference between .pl, .cgi, and .pm File Extensio <jurgenex@hotmail.com>
Re: Environment variables and AOL nobull@mail.com
Re: file search <godzilla@stomp.stomp.tokyo>
Re: Finding differences in two text strings <godzilla@stomp.stomp.tokyo>
Re: Finding differences in two text strings (Tad McClellan)
Re: Godzilla Stomps Code Red (Helgi Briem)
Re: Godzilla Stomps Code Red <godzilla@stomp.stomp.tokyo>
Grabbing links & tags from an HTML page. <nospam@smgsystems.co.uk>
Re: help understanding this snippet (Tad McClellan)
Re: How to connect to Oracle DB using perl <djberge@uswest.com>
Long on Sun? <jwilson2000@home.com>
Re: most effective way to search for different words in <bart.lateur@skynet.be>
multithreaded LWP <citykid@nospam.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 31 Aug 2001 12:02:34 -0500
From: "Jonathan Clover" <jclover@nati.org>
Subject: 3D Arrays aka tables
Message-Id: <tovgcqcmd43c39@corp.supernews.com>
Well, in the lovely world of C there is such a thing as multidimensional
arrays. I have been so accustom to this feature that I wish to use a
similar idea in perl, but how? I have not been able to find information of
how I could possible do this as an array of an array seems not to work in
perl. So, here's the challenge, how, if possible, can I accomplish such a
feat?
Jonathan
NATI
------------------------------
Date: 31 Aug 2001 17:09:25 GMT
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: 3D Arrays aka tables
Message-Id: <slrn9p00bk.ec4.trammell@haqq.hypersloth.net>
On Fri, 31 Aug 2001 12:02:34 -0500, Jonathan Clover wrote:
[snip]
perldoc perllol
--
Rule #0: Spam is theft.
------------------------------
Date: Fri, 31 Aug 2001 17:09:57 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: 3D Arrays aka tables
Message-Id: <3b8fc4e3.2b97$28d@news.op.net>
In article <tovgcqcmd43c39@corp.supernews.com>,
Jonathan Clover <jclover@nati.org> wrote:
>Well, in the lovely world of C there is such a thing as multidimensional
>arrays. I have been so accustom to this feature that I wish to use a
>similar idea in perl, but how? I have not been able to find information of
>how I could possible do this as an array of an array seems not to work in
>perl. So, here's the challenge, how, if possible, can I accomplish such a
>feat?
For example:
$a[12][37][92] = 53;
print $a[12][37][92];
http://perl.plover.com/FAQs/References.html
http://www.perldoc.com/perl5.6/pod/perllol.html
http://www.perldoc.com/perl5.6/pod/perldsc.html
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 31 Aug 2001 13:14:40 -0400
From: Vinny Murphy <vmurphy@Cisco.Com>
Subject: Re: 3D Arrays aka tables
Message-Id: <m3r8tscfsv.fsf@vpnrel.cisco.com>
"Jonathan Clover" <jclover@nati.org> writes:
> Well, in the lovely world of C there is such a thing as multidimensional
> arrays. I have been so accustom to this feature that I wish to use a
> similar idea in perl, but how? I have not been able to find information of
> how I could possible do this as an array of an array seems not to work in
> perl. So, here's the challenge, how, if possible, can I accomplish such a
> feat?
perldoc perllol gives details about manipulating arrays of arrays in
Perl.
--
Vinny
------------------------------
Date: 31 Aug 2001 10:24:51 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: 3D Arrays aka tables
Message-Id: <3b8fc863@news.victoria.tc.ca>
Jonathan Clover (jclover@nati.org) wrote:
: Well, in the lovely world of C there is such a thing as multidimensional
: arrays. I have been so accustom to this feature that I wish to use a
: similar idea in perl, but how? I have not been able to find information of
: how I could possible do this as an array of an array seems not to work in
: perl. So, here's the challenge, how, if possible, can I accomplish such a
: feat?
: Jonathan
: NATI
Perhaps by reading some of the pod files? A key item to realize is that a
perl array cannot contain other arrays, instead it must contain references
to arrays. Often this is irrelevent, everything just works, but if you
define an array of arrays then the inner arrays must be defined as
references.
e.g.
@ary = ( [1,2,3] , [4,5,6] );
note the square brackets on the inside, vs the round brackets on the
outside. The round brackets make an array, whereas the square brackets
make a reference to an array.
You can print each cell in the "obvious" way.
print $ary[0][0] , $ary[1][1] ; # etc.
At least one pod is a cookbook of data structure recipes with lots of
examples.
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
------------------------------
Date: 31 Aug 2001 15:09:57 GMT
From: TGVCDPVNTLMI@spammotel.com (Ronald Blaschke)
Subject: Re: A better way
Message-Id: <9mo9c4$3bc8s$3@ID-57488.news.dfncis.de>
On Fri, 31 Aug 2001 09:56:13 -0500, Jonathan Clover <jclover@nati.org> wrote:
> I have this code to insert a new row into a database and I would like to
> make the code, that's focused on(!) more concise, but am unsure on how.
> Ideas anyone.
> Jonathan Clover
> NATI
>
> P.S. @question will always and only contain 10 values
>
> my $dbh = DBI->connect("DBI:CSV:f_dir=$database_dir")
> or diehtml("Cannot connect: " . $DBI::errstr);
>
> ! $dbh->do( "insert into test_ans values
> ('$test','$questions[0]','$questions[1]','$questions[2]','$questions[3]','$q
> uestions[4]','$questions[5]','$questions[6]','$questions[7]','$questions[8]'
> ,'$questions[9]')" )
> ! or diehtml("Cannot do: " . $dbh->errstr());
>
> $dbh->disconnect();
How does this sound?
$sql = "insert into test_ans values ('$test',".
join(",", map { "'$_'" } @questions).
")";
#print $sql;
$dhb->do($sql) or diehtml ...
Another idea that just pops up is
@values = ($test, @questions);
$sql = "insert into test_ans values (".
join(",", map { "'$_'" } @values).
")";
Indented, for extra value. :-)
--
------------------------------
Date: 31 Aug 2001 15:12:11 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: A better way
Message-Id: <slrn9oval4.qj2.rgarciasuarez@rafael.kazibao.net>
Jonathan Clover wrote in comp.lang.perl.misc:
} I have this code to insert a new row into a database and I would like to
} make the code, that's focused on(!) more concise, but am unsure on how.
} Ideas anyone.
} Jonathan Clover
} NATI
}
} P.S. @question will always and only contain 10 values
}
} my $dbh = DBI->connect("DBI:CSV:f_dir=$database_dir")
} or diehtml("Cannot connect: " . $DBI::errstr);
}
} ! $dbh->do( "insert into test_ans values
} ('$test','$questions[0]','$questions[1]','$questions[2]','$questions[3]','$q
} uestions[4]','$questions[5]','$questions[6]','$questions[7]','$questions[8]'
} ,'$questions[9]')" )
} ! or diehtml("Cannot do: " . $dbh->errstr());
I suppose the '!' are typos.
No column names in your SQL statement? Dangerous, because the schema of
your table may change in the future.
Advice: DO NOT interpolate directly variables when constructing the
string that contains your SQL query. Use variable binding (as described
in the documentation for DBI.pm) :
my $sth = $dbh->prepare(
qq/insert into test_ans values (?,?,?,?,?,?,?,?,?,?,?)/
);
$sth->execute( $test, @questions );
This also quotes the values passed into the statement. Thus, if $test
(for example) contains a single quote, this won't trigger a runtime SQL
syntax error.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 31 Aug 2001 18:44:14 +0100
From: nobull@mail.com
Subject: Re: a perl module dedicated to lists ?
Message-Id: <u9sne89lap.fsf@wcl-l.bham.ac.uk>
"Francis Derive" <Francis.Derive@wanadoo.fr> writes:
> This is it : is there a perl module dedicated to lists ?
>
> i.e., (member $elem @list), oh ! I beg your pardon : member( $elem, @list);
> delete( $elem, @list ); ( in many ways ). And so on, closed to so long as
> Lisp does.
These look like candiates for the List::Util::Trivial module that I
keep meaning to getting around to writing.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 31 Aug 2001 18:05:52 +0200
From: Andreas Weymer <weymer@mediawise.de>
Subject: Alternations in Parse::RecDescent
Message-Id: <3B8FB5E0.6757F0C8@mediawise.de>
Hi,
I'm using alternations in some productions but in contrast to the
definition of the |-operator, I'm looking
for a behaviour which is XOR (^) not OR (|). So far I used the <reject>
directive to simulate such a behaviour.
use Parse::RecDescent;
$grammar =
q{
line : (word1 | word2)(s) <reject: $item[1][0] eq
$item[1][1]>
{ print "Found different words\n"; }
word1 : "one"
word2 : "two"
};
$parser = new Parse::RecDescent($grammar);
if(1){
$data = "one two";
}
else{
$data = "one one";
}
defined $parser->line($data) or print "Found same words\n";
Word1 followed by word2 and vice versa is passed, word1 word1 (word2
word2) is rejected.
This works fine for n=2, but for n>2 setting up the <reject>-conditions
gets ugly if I have to test every
entry of @{$item[1]} against each other.
Is there any easy solution to this?
Thanks,
Andreas
------------------------------
Date: 31 Aug 2001 08:44:47 +0100
From: nobull@mail.com
Subject: Re: Calling sub funcs with scalar variables?
Message-Id: <u91ylsb13u.fsf@wcl-l.bham.ac.uk>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> According to Yves Orton <demerphq@hotmail.com>:
> > my $obj=Foo::Bar->$method();
>
> Yes, that's another way to restrict the set of callable functions.
No, it is not.
sub function_I_should_not_be_able_to_call {
print "Please stop peddling this dangerous snake oil\n";
}
my $method='main::function_I_should_not_be_able_to_call';
my $obj=Foo::Bar->$method();
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 31 Aug 2001 18:20:36 +0100
From: nobull@mail.com
Subject: Re: Calling sub funcs with scalar variables?
Message-Id: <u9zo8g9me3.fsf@wcl-l.bham.ac.uk>
Uri Guttman <uri@sysarch.com> writes:
> >>>>> "n" == nobull <nobull@mail.com> writes:
>
> >> my $method='new';
> >> my $obj=Foo::Bar->$method();
>
> n> Warning: this is still a symbolic reference.
>
> n> Symbolic method references are exempted from strict checking because
> n> there's no such thing as a hard method reference so if you're using
> n> method reference syntax at all you must have been deliberately using
> n> symbolic references.
>
> i wouldn't call that symbolic referencing.
That is because you consider "symbolic referencing" to be an
emmotionally charged term.
> all methods are looked up at run time (and that result is cached
> somewhat), so there is no way to have strict enforce it as you
> say. in fact creating a method name on the fly is a very useful
> technique and can support polymorphism and other things. stem uses
> this to create the best method name for delivery of a message.
So you appear to be saying the reason you "wouldn't call this symbolic
referencing" is because it "is a very useful technique" and you can't
bring yourself to say that symbolic referencing is ever a useful
technique.
> n> Symbolic method references are still eqaually dangerous from a
> n> security standpoint since $method can contain a package qualified name
> n> and there's no recursive check made of @Foo::Bar::ISA to ensure that
> n> the package specified in $method is really an ancestor of Foo::Bar.
>
> use can() to check that first.
You can use can(), but it has no effect - execept, of course, to lull
the programmer into a false sense of security. Please see my "Snake
oil alert!" article <u91ypd62ze.fsf@wcl-l.bham.ac.uk> from last time
you (Uri) and I (NoBull) discussed this.
> n> I recommend not using Foo::Bar->$method() unless the OO paradigm fits
> n> for some other reason.
>
> i disagree.
Really? Any reason for that?
> it is not for day to day OO but if you understand how to use it, it
> is VERY powerful. many languages wish they could select methods at
> run time.
I agree totally with the above statements. However I fail to see
their relevance here. I said if the OO paradigm fits then wear it.
What I also said was that you shouldn't use OO simply because it
allows you to use symbolic refs whilst pretending not to.
Of course, your above statement apply equally to subroutine symrefs
are also are not for day to day but if you understand how to use them,
they are VERY powerful.
> n> If you want to use a package symbol table rather than a simple hash as
> n> your dispatch table I recommend:
>
> n> { no strict 'refs'; "Foo::Bar::$method"->(); }
>
> n> Or:
>
> n> *{$Foo::Bar::{$method}}{CODE}->();
>
> those are not method calls, they are straight symref sub calls and are
> as bad as the original idea.
Yes, the first one is a _stright_ symref sub call as opposed to
an obfuscated symref call.
The second is actually an explicit dispach table call, except that the
dispatch table it uses happens to be a Perl symbol table, not a simple
hash.
Neither is as bad as the original idea becase unlike the orginal idea
(or the indirect method syntax) as they do not allow calling of
arbitrary subroutines.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 31 Aug 2001 12:02:07 -0500
From: "Edward J. D'Avignon" <davignon@vitesse.com>
Subject: Check for valid hex value
Message-Id: <3B8FC30F.FA12F5F5@vitesse.com>
How can I check that a value entered is a valid hex value? The entry is
up to 16 hex digits long and I need to ensure it only contains the
characters 0123456789abcdf.
Thanks for the help,
Ed
------------------------------
Date: Fri, 31 Aug 2001 17:16:13 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Check for valid hex value
Message-Id: <3b8fc65d.2bba$27e@news.op.net>
In article <3B8FC30F.FA12F5F5@vitesse.com>,
Edward J. D'Avignon <davignon@vitesse.com> wrote:
>How can I check that a value entered is a valid hex value? The entry is
>up to 16 hex digits long and I need to ensure it only contains the
>characters 0123456789abcdf.
if ($value =~ /[^0-9a-f]/) {
# it contains a bad character
} elsif (length($value) > 16) {
# it is too long
} else {
# it's good
}
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 31 Aug 2001 09:50:13 -0700
From: arice@benchmark-systems.com (Alan Rice)
Subject: Compiling Perl 5.6.1
Message-Id: <d86c5ce1.0108310850.103f52ba@posting.google.com>
Hey All
I'm tring to Compile Perl 5.6.1 on an aix 4.2.1.0 box.
Using gcc version 2.95.2 19991024 (release) gotton for UCLA's site.
Steps 1 and 2 work fine
It's the make giving me poblems.
make
`sh cflags libperl.a miniperlmain.o` miniperlmain.c
CCCMD = gcc -DPERL_CORE -c -fno-strict-aliasing -I/usr/local/include
-O
`sh cflags libperl.a perl.o` perl.c
CCCMD = gcc -DPERL_CORE -c -fno-strict-aliasing -I/usr/local/include
-O
`sh cflags libperl.a gv.o` gv.c
CCCMD = gcc -DPERL_CORE -c -fno-strict-aliasing -I/usr/local/include
-O
`sh cflags libperl.a toke.o` toke.c
CCCMD = gcc -DPERL_CORE -c -fno-strict-aliasing -I/usr/local/include
-O
gcc: Internal compiler error: program cc1 got fatal signal 9
make: 1254-004 The error code from the last command is 1.
Can anyone tell me What a fatal signal 9 is and how to fix it?
Alan
arice@benchmark-systems.com
------------------------------
Date: Fri, 31 Aug 2001 12:26:36 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Dangerous Perl Script?
Message-Id: <7713-3B8FC8CC-57@storefull-242.iap.bryant.webtv.net>
Thanks for explaining it. I had a feeling I better ask before I let it
run on my webserver. I'm sure glad I asked here first. I wouldn't dare
run it on a webserver now.
Regards,
--Dennis
------------------------------
Date: Fri, 31 Aug 2001 10:37:44 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <3b8fcb68$1@news.microsoft.com>
"Trewth Seeker" <trewth_seeker@yahoo.com> wrote in message
news:d690a633.0108302015.60293f45@posting.google.com...
> .pl and .cgi files also must be "installed onto a server" -- where *else*
> do you expect them to be?
Hmm, then I guess my computer is broken.
If I type "foobar.cgi" at the command line my computer will run the program
"foobar.cgi". No server of whatever kind involved here.
jue
------------------------------
Date: 31 Aug 2001 18:23:11 +0100
From: nobull@mail.com
Subject: Re: Environment variables and AOL
Message-Id: <u9y9o09m9s.fsf@wcl-l.bham.ac.uk>
usad1@gadnet.com (G.A.D.Miles) writes:
> I posted a question about this back in January and was so startled by
> the tone and content of response from "abigail" that I gave up.
She probably told you that your question has nothing whatever to do
with Perl and that it was therefore not on-topic. Abigail makes even
my treatment of off-topic posters seem gentle.
> Here, phrased differently, and I hope more to people's liking, is the
> question again:
Changing the phrasing of your question does not alter the fact that it
has nothing to do with Perl. The fact that you may _describe_ bits of
your question in Perl and that you were writing in Perl when you
encountered the question no more makes your question related to Perl
than does the fact that you write your question in English make it a
question related to English.
Anyhow the previous thread already answered your question. Asking
the same question again won't change the answer.
> But, in AOL only, if the user invokes the script in a new window (ie
> right clicks on the link to the script and selects the new window
> option) the above variable is blank. Doing the same thing in IE or
> Netscape works fine.
> b) Is this a bug in AOL or are they welcome to populate environment
> variables with anything they feel like?
I would consider the fact that the AOL browser doesn't put a Referer
header in HTTP requests that result from "open in new window" clicks
to be a minor bug. Even though omiting the Referer header in this (or
any other) contxt doesn't actually violate the word RFC2616 of I think
it goes against the spirit. Please submit a bug report it to the
relevant entity.
And just in case you still are not 100% clear on this, allow me to
reiterate that this has nothing whatever, in the least, to do with
Perl in any way shape or form.
> And "abigail", if you are reading this and boiling with the same rage
> as last time, save yourself some time and don't reply.
I have looked at Abigail's contibutions to your previous thread.
There is no boiling rage there.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 31 Aug 2001 08:08:03 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: file search
Message-Id: <3B8FA853.1B4C9489@stomp.stomp.tokyo>
Godzilla! wrote:
> Bob Lockie wrote:
(snipped)
> #! perl
For the second time in the past ten days, I inadvertently
copied out a stage development script just previous to my
final script version and, posted final printed results.
My script posted will not print your key line as it is
missing my newline print $_ trigger code:
$position++;
seek (TEST, -$position, 2);
Those two lines will be noted as the difference. They are
used to move back one character to capture a \n to trigger
a print of a current line.
"...rather than add code to continue backwards until a newline
is found just previous to your line with a keyterm."
This part of my post will make better sense now. It is easier
to move back exactly one character rather than backwards seek
an unknown amount of characters until a newline is found.
Sorry for any inconvenience. Fortunately, my habit is to
review my articles looking for mistakes, such as this.
Godzilla!
--
#! perl
open (TEST, "test.txt");
$position = 0;
do
{
seek (TEST, -$position, 2);
$position++;
}
until (index (<TEST>, "line three") > -1);
$position++;
seek (TEST, -$position, 2);
while (<TEST>)
{ print $_; }
close (TEST);
exit;
------------------------------
Date: Fri, 31 Aug 2001 09:18:19 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Finding differences in two text strings
Message-Id: <3B8FB8CB.4D062BE9@stomp.stomp.tokyo>
Andrew Paul Gorton wrote:
(snipped)
> I have two arrays with the values changing at different places in my
> script. I need to compare the two arrays and save the difference
> between them.
> So I have a @stored and a @current array, which can be of any length and
> contain any text.
> I first calculate the length of the arrays and if they are different
> then I need to find how they are different.
Using length () as a test of equality is risky business.
Unless carefully coded, unless strict parameters are used,
length comparisons can report false positives, which is why
home pregnancy tests are a causation of high anxiety and,
frequently, masculine impotency, as does length comparisons.
It is very possible to have various arrays, various strings
of a dissimilar nature but of equal length.
$x = "x";
$y = "y";
if (length ($x) == length ($y))
{ print "\$x equals \$y"; }
As often is the case, no Perl 5 Cargo Cult modules are
needed for this simple comparative task.
Godzilla!
--
#! perl
print "Content-type: text/plain\n\n";
@Standard = qw (Godzilla Rocks!);
@Variable = qw (Godzilla Rocks And Rolls!);
$standard = "@Standard";
$variable = "@Variable";
print "\@Standard Contains These Terms Which \@Variable Does Not:\n ";
for (@Standard)
{
if (index ($variable, "$_ ") == -1)
{ print "$_ "; }
}
print "\n\n\@Variable Contains These Terms Which \@Standard Does Not:\n ";
for (@Variable)
{
if (index ($standard, "$_ ") == -1)
{ print "$_ "; }
}
exit;
PRINTED RESULTS:
________________
@Standard Contains These Terms Which @Variable Does Not:
Rocks!
@Variable Contains These Terms Which @Standard Does Not:
Rocks And Rolls!
------------------------------
Date: Fri, 31 Aug 2001 11:29:14 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Finding differences in two text strings
Message-Id: <slrn9ovbaa.47p.tadmc@tadmc26.august.net>
Andrew Paul Gorton <gortona@cs.man.ac.uk> wrote:
>I first calculate the length of the arrays and if they are different
>then I need to find how they are different.
They may be different yet have the same "length" you know:
@a = q2/zero one two/;
@b = q2/Zero One Two/;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 31 Aug 2001 15:09:36 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Godzilla Stomps Code Red
Message-Id: <3b8fa854.168115176@news.isholf.is>
On Thu, 30 Aug 2001 11:24:05 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>I am female. I do not type with my thumbs.
>
No way are you female, Kira. You are a female
impersonator as well as a Perl coder impersonator.
Regards,
Helgi Briem
------------------------------
Date: Fri, 31 Aug 2001 08:28:09 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Godzilla Stomps Code Red
Message-Id: <3B8FAD09.42F48D6C@stomp.stomp.tokyo>
Helgi Briem aka The CLPM Troll wrote:
> Godzilla! wrote:
> >I am female. I do not type with my thumbs.
> No way are you female, Kira. You are a female
> impersonator as well as a Perl coder impersonator.
Feeling more impotent than usual lately, Frank?
Godzilla! Terrifies Men More Than A Cold Pool At A Nudist Colony.
------------------------------
Date: Fri, 31 Aug 2001 18:30:49 +0100
From: Stuart Grimshaw <nospam@smgsystems.co.uk>
Subject: Grabbing links & tags from an HTML page.
Message-Id: <VYPj7.12344$NE.786665@wards>
I'm trying to grab the href= & the text spanned by a <A html tag.
I want to be able to access the info in a manner similar to:
print $tags{'Januray 2001'};
or something similar, where the line it was grabbed from would look
something like:
<a href="http://localhost/report_jan_01.html">January 2001</a>
Currently the program takes each of the links and goes and retreives the
page to find the page title, report description and a couple of other
things, but we have that many that it's taking too long, and it's been
decided that just the report title will be enough, which I can get from the
index page (hopefully) in a manner similar to that which I describe above.
If I did:
(@links, @titles) = ($INDEX =~ /href="(.*?)">(.*?)<\/a>/gi);
Would there be any way of tieng the two sets of results together so they
matched up?
------------------------------
Date: Fri, 31 Aug 2001 11:24:45 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: help understanding this snippet
Message-Id: <slrn9ovb1t.47p.tadmc@tadmc26.august.net>
Ren Maddox <ren@tivoli.com> wrote:
>On Fri, 31 Aug 2001, davidhilseenews@yahoo.com wrote:
>> "Tad McClellan" <tadmc@augustmail.com> wrote in message
>> news:slrn9otip3.192.tadmc@tadmc26.august.net...
>>> uNcONvEntiOnaL <tomcat@visi.com> wrote:
>>> >for (x$=0;$x < 24; $x++) {
>>> This would seem more clear to me:
>>> foreach my $x ( 0..24 ) {
>>>
>>
>> You mean
>>
>> foreach my $x ( 0..23 ) {
>
>Which seems to exemplify Tad's point... :)
That's why I did it (yeah, that's the ticket).
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 31 Aug 2001 10:55:31 -0500
From: Mr Sunblade <djberge@uswest.com>
Subject: Re: How to connect to Oracle DB using perl
Message-Id: <3B8FB372.FEBD52AB@uswest.com>
Mr_Ocp wrote:
> Hi Folks
> I am very new at perl, I am creating an intranet web site which would
> retrieve data from Oracle 8i Datbase. I have no clue how to configure
> connection to oracle using Perl5.
>
> Can you please help do this, would appreciate if you can provide some
> examples.
>
> Thanks for your help
> Mike
1) Install DBI (on cpan)
2) Install Oracle client on system
3) Install DBD-Oracle (on cpan - don't worry if test fails necessarily)
4) Buy "Using the Perl DBI" by Tim Bunce (O'Reilly & Assoc) or
wade through HTML docs on cpan.
Once steps 1..4 have been completed:
my $dbh = DBI->connect(db, user, passwd, driver);
my $sth = $dbh->prepare("select sysdate from dual");
$sth->execute();
my $result = $sth->fetchrow_array();
print "Result was: $result\n";
$sth->finish(); # optional for this case
$dbh->disconnect();
Regards,
Mr. Sunblade
--
"Evil will always triumph because Good is *dumb*."
-- Dark Helmet, 'Spaceballs: The Movie'
------------------------------
Date: Fri, 31 Aug 2001 17:44:29 GMT
From: "Jeff Wilson" <jwilson2000@home.com>
Subject: Long on Sun?
Message-Id: <12Qj7.22393$MK5.14623469@news1.sttln1.wa.home.com>
Does anyone know if packing/unpacking a long on a Sun Solaris machine uses
32 or 64 bits?
Thanks.
Jeff Wilson
------------------------------
Date: Fri, 31 Aug 2001 15:45:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: most effective way to search for different words in a text
Message-Id: <74cvots1caq48276v9glplj8jjfqrhlkih@4ax.com>
Peter Sørensen wrote:
>I would like to ask what the most effective way to do a search in a
>text would be. I would like to do a search where I find either following
>words: WORD1 WORD2 WORD3 and the word MUST
Assuming the similarity between "WORD1", "WORD2" and "WORD3" is
incidental, I'd use:
/\b(?:WORD1|WORD2|WORD3)\b/ && /\bMUST\b/
Note that this is not a regex, but perl code. Using perl string
manipulation, you can whip up this text, and with eval and the magic
words "sub { $code }" you can make an anonymous sub to do the search,
one invokation per text sample in $_.
--
Bart.
------------------------------
Date: Fri, 31 Aug 2001 10:23:42 -0700
From: Les Ander <citykid@nospam.edu>
Subject: multithreaded LWP
Message-Id: <Pine.LNX.4.33.0108311009190.30407-100000@schewanella.stanford.edu>
Hi,
I have a question regarding threads. I have never used them, but
I have a problem that needs me to use them.
The problem is as follows:
-------------------------
I need to send about 6000 request to the
server that takes about 3 minute to process every request. They give
me an ID for every request, so I can retrieve the results within 24 hours.
So this is what I want to do:
----------------------------
currently I am sending them one request at a time, parsing out the ID,
waiting for 3 minutes and then retrieving the results with the ID, and
then repeating this cycle. But this will take forever if I do this
for 6000 requests. So instead I want to send them requests every about 15
seconds or so, store the ID and then when all the requests are done, I
will wait till the trafic is low before I request the results in batch or
every 15 seconds. I think this would be lot more efficient.
so...
-----
Can some one give me an simple example of using threads for making such
LWP requests?
You can suppose that I have done the following routines available:
# This function will make a request with appropriate parameters
# and return a html page containing ID
make_initial_request()
# This function will parse the ID from the html page returned
parse_id()
# This function will make a request again for the results with the ID
get_results_id()
thankyou
les
------------------------------
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 1669
***************************************