[13633] in Perl-Users-Digest
Perl-Users Digest, Issue: 1043 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 11 17:10:30 1999
Date: Mon, 11 Oct 1999 14:10:18 -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: <939676218-v9-i1043@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 11 Oct 1999 Volume: 9 Number: 1043
Today's topics:
Re: Perl Syntax for oracle database interaction <makkulka@cisco.com>
Re: Question: How do I get the length of a string in PE <makkulka@cisco.com>
Re: Question: How do I get the length of a string in PE <x@x.com>
returning the first key and value pairing form a sorted <tom.kralidis@ccrs.nrcanDOTgc.ca>
Re: returning the first key and value pairing form a so (Kragen Sitaker)
Re: running other programs from perl schan6128@my-deja.com
Re: search engine!! (Abigail)
Re: simple search (Abigail)
sprintf help <scott_beck@my-deja.com>
Re: sprintf help <theglauber@my-deja.com>
Re: unused files script (ItsMe9905)
VERY Newbie with stoopid Question <blackfrdNOblSPAM@hotmail.com.invalid>
Re: VERY Newbie with stoopid Question (Kragen Sitaker)
Re: VERY Newbie with stoopid Question <dove@synopsys.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 11 Oct 1999 12:11:37 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Perl Syntax for oracle database interaction
Message-Id: <38023669.1D948D98@cisco.com>
{
dnr74 wrote:
> I'm trying to find out the syntax of Oraperl for being able to do a
> insert command.
> The problem that I'm having is with &ora_bind. If someone could post a
> simple example of using oraperl to insert values into a table, I would
> appreciate it.
For inserting into table T with 3 columns and with AutoCommit off.
--
$lda = ora_logon ( $connect_string, $name , $password ) or die " cannot
connect to the database..." ;
$sql = <<end;
insert into T (
col1, col2, col3 )
values (
:1,:2,:3 )
end
$csr = ora_open( $lda , $sql ) or die " cannot open the cursor " ;
# assume at some point in the program assume
# that @v contains the three values
# you want to insert.
if ( ora_bind ( $csr , @v ))
{
ora_commit ($lda ); # commit these values
}
else
{
# insert failed.
ora_rollback ($lda) ; # if needed.
}
--
------------------------------
Date: Mon, 11 Oct 1999 11:59:11 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Question: How do I get the length of a string in PERL?
Message-Id: <3802337F.90015FE2@cisco.com>
Zak Keith wrote:
> Question: How do I get the length of a string in PERL?
By using function length ().
perldoc -f length
-
------------------------------
Date: Mon, 11 Oct 1999 22:02:22 +0200
From: "Zak Keith" <x@x.com>
Subject: Re: Question: How do I get the length of a string in PERL?
Message-Id: <7ttfuk$hrh$1@cubacola.tninet.se>
Thanks guys! The link below is a GREAT help!
Zak
Dan Baker wrote in message <38021F52.4463F428@busprod.com>...
>
>
>Zak Keith wrote:
>>
>> Question: How do I get the length of a string in PERL?
>--------------
>http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html
>
>is a great place to start for online docs.
>
>Dan
------------------------------
Date: Mon, 11 Oct 1999 16:02:04 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: returning the first key and value pairing form a sorted hash
Message-Id: <3802423C.D6535D3F@ccrs.nrcanDOTgc.ca>
Hi,
I've generated a hash from various array elements, with:
foreach (@array)
{
@line = split (/\s+/, $_);
print "x,y fits: $line[5], $line[6]\n";
$pointID = $line[1];
$error = (abs $line[5]) + (abs $line[6]);
printf "Total error of $pointID is: %.3f metres \n", $error;
push(@{ $errorList{$error} }, $pointID );
}
# then printing the hash out
print "Error ID\n\n";
foreach $string (reverse sort keys %errorList)
{
print "$string: @{$errorList{$string}}\n";
}
..from this sorted list, I would like to assign the first key and value
pairing to an array, to use in other files, but can't seem to make it
happen. I can't seem to find the correct syntax.
I tried printing:
print "$errorList[0][0]\n";
..but got an uninitialized value.
Can anyone offer some advice?
Thanks
-----------------------------------------------------------------------------------------
Tom Kralidis Geo-Spatial Technologist
Canada Centre for Remote Sensing Tel: (613) 947-1828
588 Booth Street , Room 241 Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7 http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------
------------------------------
Date: Mon, 11 Oct 1999 20:49:12 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: returning the first key and value pairing form a sorted hash
Message-Id: <c3sM3.6688$UG5.442562@typ11.nn.bcandid.com>
In article <3802423C.D6535D3F@ccrs.nrcanDOTgc.ca>,
Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca> wrote:
> foreach (@array)
> . . .
> push(@{ $errorList{$error} }, $pointID );
> }
> . . .
>foreach $string (reverse sort keys %errorList)
>{
> print "$string: @{$errorList{$string}}\n";
>}
>
>..from this sorted list, I would like to assign the first key and value
>pairing to an array, to use in other files, but can't seem to make it
>happen. I can't seem to find the correct syntax.
>
>I tried printing:
>
>print "$errorList[0][0]\n";
>
>..but got an uninitialized value.
As long as you're already printing it out, why don't you save it? The
most straightforward way would be like this:
my $lastone;
foreach $string (reverse sort keys %errorList)
{
print "$string: @{$errorList{$string}}\n";
$lastone = $errorList{$string}->[0];
}
Of course, if you want the *first* one, you could say
$firstone = $errorList{$string}->[0] if not defined $firstone;
(I'm confused about which you want because your strings are backwards.)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Mon Oct 11 1999
29 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 11 Oct 1999 20:29:23 GMT
From: schan6128@my-deja.com
Subject: Re: running other programs from perl
Message-Id: <7tthah$do0$1@nnrp1.deja.com>
> The simplest way to do this is like this:
> system("program1 &");
> system("program2 &");
> system("program3 &");
When you execute programs like that, does perl wait for the first
program to finish and then executes the next one?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 11 Oct 1999 14:35:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: search engine!!
Message-Id: <slrn804f0f.gep.abigail@alexandra.delanet.com>
Daniel Lee (daniel_lsl@go.com) wrote on MMCCXXXII September MCMXCIII in
<URL:news:1999Oct11.170309.27625@leeds.ac.uk>:
-- Hi I'm currently doing a project on web search engine. I'm contemplating on
-- whether to use Java or Perl. Can anyone out there advice me on which languag
-- to use. Which is more efficient, easy,...... Thanks
The web is big. Very big. There are already many search engines out there.
If you have to ask such a question, that means you are unfamiliar with at
least one of the two languages. I'd pick the one you are familiar with.
If neither, pick a language you *are* familiar with.
If there isn't a language you are familiar with, pick another project
to learn programming with.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 11 Oct 1999 14:44:27 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: simple search
Message-Id: <slrn804fge.gep.abigail@alexandra.delanet.com>
kev (kevin.porter@fast.no) wrote on MMCCXXXII September MCMXCIII in
<URL:news:380209A3.E374D013@fast.no>:
{}
{} My client wants 'simple keyword searches' implemented on his site, for
{} searching through news stories and articles which they update manually.
{} Bearing in mind we're not talking millions of page views per day, what's
{} the usual solution with Perl when a simple search is required?
What is a simple search? Just looking for a fixed string? If the user
ask for 'foo bar', should it return articles that mention 'foo' and
'bar', or should 'foo' and 'bar' be separated by a space? What if 'foo'
is at the end of a line, and 'bar' is on the beginning of the next?
Do you want to search the entire text, or just the titles? Do you want
to match parts of the words? Do the results have to be ordered in some
form of scoring?
Are the news articles just plain text, or does it have some meta
information as well, like keywords, summaries, dates, authors, etc?
{} I could either implement a 'real' search engine, or I could write a
What is a 'real' search engine? As opposed to what? A 'fake' one?
{} little prog to actually search (with grep or regexes) all of their
{} articles. The former solution would (presumably) require the client to
{} reindex their search periodically (too complicated for the user
{} possibly), but the latter solution will become very slow when there are
{} lots of articles.
{}
{} Am I thinking in the right direction? Opinions gratefully received.
Yes, the latter will indeed be slow if there are lots of articles.
Or a small number of articles, and many users at once.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 11 Oct 1999 20:22:03 GMT
From: Scott Beck <scott_beck@my-deja.com>
Subject: sprintf help
Message-Id: <7ttgsr$dbo$1@nnrp1.deja.com>
Can someone point in the write direction to learn more
about the sprintf command. I have read the perldocs on it
and none of them seem to get into much detail.
--
Thanks
Scott Beck
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 11 Oct 1999 20:39:03 GMT
From: The Glauber <theglauber@my-deja.com>
Subject: Re: sprintf help
Message-Id: <7ttht5$e7t$1@nnrp1.deja.com>
In article <7ttgsr$dbo$1@nnrp1.deja.com>,
Scott Beck <scott_beck@my-deja.com> wrote:
> Can someone point in the write direction to learn more
> about the sprintf command. I have read the perldocs on it
> and none of them seem to get into much detail.
perldoc -f sprintf, in my system, showed all the documentation. The
problem is, this whole printf/sprintf stuff is based on C, and if you
don't know C you may be baffled by it. Look for a C textbook, or a
friendly C programmer.
Keep in mind that in C you pass the buffer to be populated by sprintf
as the first parameter; in Perl, you don't pass a buffer, you just use
the return value from sprintf directly to populate a variable:
in C: sprintf( buffer, "%09d", myint );
in Perl: $buffer = sprintf "%09d", $myint;
HTH...
glauber
--
Glauber Ribeiro
theglauber@my-deja.com
"Opinions stated are my own and not representative of Experian"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 11 Oct 1999 20:19:16 GMT
From: itsme9905@aol.comnojunk (ItsMe9905)
Subject: Re: unused files script
Message-Id: <19991011161916.12945.00000140@ng-cc1.aol.com>
I think Ace meant "orphaned" files.
------------------------------
Date: Mon, 11 Oct 1999 12:50:22 -0700
From: blackfrd <blackfrdNOblSPAM@hotmail.com.invalid>
Subject: VERY Newbie with stoopid Question
Message-Id: <000b8d9b.8ee0be06@usw-ex0101-007.remarq.com>
OK, I am a little embarrased to ask this.
But here goes. I have the Perl stable interpreter (?) on my windows NT
box. I have clicked on the configure icon and it does something in the
command window and then quits.
Fine.
I write a program in notepad.
Now how the hell do I run it? what is the way to execute a program to
debug in in windows.
Please help because I really want to learn this language!!!!!!
Cole
Blackfrd@hotmail.com
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Mon, 11 Oct 1999 20:37:07 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: VERY Newbie with stoopid Question
Message-Id: <TTrM3.6663$UG5.440498@typ11.nn.bcandid.com>
In article <000b8d9b.8ee0be06@usw-ex0101-007.remarq.com>,
blackfrd <blackfrdNOblSPAM@hotmail.com.invalid> wrote:
>Now how the hell do I run it? what is the way to execute a program to
>debug in in windows.
>
>Please help because I really want to learn this language!!!!!!
On running, see the 'perlrun' page. On debugging, see the 'perldebug' page.
If you have ActiveState's distribution, they're on your start menu.
Otherwise, try perldoc perlrun and perldoc perldebug.
(You might also try perldoc perldoc and perldoc perlfaq, even if you
just skim them.)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Mon Oct 11 1999
29 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Mon, 11 Oct 1999 13:39:29 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: VERY Newbie with stoopid Question
Message-Id: <38024B01.535A08AC@synopsys.com>
Hi Cole.
blackfrd wrote:
> I write a program in notepad.
>
> Now how the hell do I run it? what is the way to execute a program to
> debug in in windows.
What you need to do is bring up the command prompt, and then type
C:> perl C:\path\to\your\perl\script
This will work if Perl is in your path.
The command prompt is limited sometimes. (I can't get it to scroll). So I
actually run my perl scripts inside of emacs using the shell command.
Hope this helps,
-=dav
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 1043
**************************************