[16609] in Perl-Users-Digest
Perl-Users Digest, Issue: 4021 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 15 09:05:28 2000
Date: Tue, 15 Aug 2000 06:05:15 -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: <966344715-v9-i4021@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 15 Aug 2000 Volume: 9 Number: 4021
Today's topics:
Re: "Setting locale failed" error on 5.6 rpm upgrade (Colin Keith)
Re: ARRAY of HASH values (Anno Siegel)
Re: Ascii highlight code? (Martien Verbruggen)
Re: Cookie refresh problem under netscape commmunicator <lincolnmarr@europem01.nt.com>
Dangers of older perl (was Re: rand() not random at all (Randal L. Schwartz)
Re: date and time in perl <bill.kemp@wire2.com>
Re: Get ip from visitor <nickco3@yahoo.co.uk>
Re: grep() optimisation (fvw)
Re: grep() optimisation (fvw)
Re: Help: libs with Latin-1 or Unicode? <flavell@mail.cern.ch>
Re: Help: libs with Latin-1 or Unicode? <flavell@mail.cern.ch>
Re: How to change Popup frame's URL <psi@nospam.mikrolog.fi>
Re: map | grep <bart.lateur@skynet.be>
Re: Multiline regexp search and replace? (Anno Siegel)
Re: Multiline regexp search and replace? (Greg Bacon)
Re: need help with msql and perl (Anthony Peacock)
Re: Negativity in Newsgroup (Martien Verbruggen)
Re: Negativity in Newsgroup <john.porter-1@ksc.nasa.gov>
Passwords <alex.buell@tahallah.clara.co.uk>
Pattern match - Extract info from a page <valued_customers@emai.com>
Re: Perl to excel <iltzu@sci.invalid>
Problem with IIS4 <fb@ltec.ch>
strict and recursive functions <Uwe.Doetzkies@Dresdner-Bank.com>
Re: strict and recursive functions (Greg Bacon)
translating tr/a-z/A-Z/ best or s/..... <jimmy.lantz@ostas.lu.se>
Re: translating tr/a-z/A-Z/ best or s/..... <bcaligari@shipreg.com>
Re: translating tr/a-z/A-Z/ best or s/..... nobull@mail.com
Re: translating tr/a-z/A-Z/ best or s/..... <thoren@southern-division.com>
What's the best way to overwrite a string with '*? <alex.buell@tahallah.clara.co.uk>
Re: What's the best way to overwrite a string with '*? <bcaligari@shipreg.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 15 Aug 2000 12:29:35 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: "Setting locale failed" error on 5.6 rpm upgrade
Message-Id: <PIam5.127$DT4.3728595@nnrp2.clara.net>
cross post to comp.lang.perl removed, that group was dropped in favour of
the c.l.p.* hierarchy.
In article <39981442.73337E49@forestry.umn.edu>, "Kirk R. Wythers"
<kwythers@forestry.umn.edu> wrote:
>I'm not sure what I should do next. Can someone point me in the right
>direction to get these "local settings" set?
Locale variables are environmental variables that define things like the
character sets, currency, etc. Its an OS setting and nothing to do with Perl
- though Perl can use locale settings (see perldoc perllocale and perldoc
locale). Since its an OS thing and I don't have a shell open on a linux box
try "man -k locale" and also try the comp.os.linux.* if you still have
problems with setting them.
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: 15 Aug 2000 12:37:54 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: ARRAY of HASH values
Message-Id: <8nbdj2$h8j$1@lublin.zrz.tu-berlin.de>
Mouse <glodalec@yahoo.com> wrote in comp.lang.perl.misc:
>Hello !
>
>I know, similar problem was posted already.
>
>I have a subroutine which returns array of hashes.
>
>sub SYSGROUP_select
>{
> my $sth = $dbh->prepare(qq(SELECT * FROM sysgroup)) ;
> $sth->execute ;
>
> @ARRAY=();
It is, umm, uncustomary to use variable names in allcaps.
> while (@row = $sth->fetchrow_array( ))
> {
> %rec=();
You are obviously not running under strict if you are allowed to use
an unqualified global variable here. Use
my %rec; # This creates an empty hash. No need to assign ().
instead. See below why, in this case, this is not merely a matter
of style.
> $rec{ sysname } = $row[0];
> $rec{ sysdesc } = $row[1];
> push(@ARRAY,%rec);
While this is valid Perl code, it doesn't do what you think it does.
You are using %rec in a list context here. This expands the hash %rec
into a list that contains, in turns, each key from the hash, followed
by the corresponding value. Now you push this list onto @ARRAY, losing
the individuality (and more) of each hash in the process. I strongly
advise you to study perlref, perldsc and perlreftut. If you do, you
will find that you will have to write
push(@ARRAY,\%rec);
instead. This will push a *reference* to %rec on the list, which is
presumably what you want.
But this is not the whole story. Without the my(), %rec is a global
hash (more precisely, a hash in package main), you'd be using a
reference to the very same variable each time through the loop.
The result would be an @ARRAY that contains so many copies of
(references to) the hash %rec, all containing what was last assigned
to %rec. However, when you declare %rec with my() inside the loop,
Perl will give you a new variable each time through, so each reference
will contain what was assigned to %rec during its particular pass
through the loop.
Note that you don't really need the named hash %rec to achieve what
you are doing, though it may help to keep things straight while you
are not yet entirely comfortable with references. You might as well
create an anonymous hashref and push it onto @ARRAY in one go:
push @ARRAY, { sysname => $row[ 0], sysdesc => $row[ 1]};
> }
> return @ARRAY ;
>}
>
>Now I would like to read something like $ARRAY[3]{sysname}.
$ARRAY[3]->{sysname};
But since you have now read everything available about Perl references
you knew that.
Anno
PS: Code above is untested
------------------------------
Date: 15 Aug 2000 12:03:35 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: Ascii highlight code?
Message-Id: <slrn8picdn.4ap.mgjv@martien.heliotrope.home>
On 14 Aug 2000 13:02:52 -0500,
Logan Shaw <logan@cs.utexas.edu> wrote:
> In article <39981829.BBFC248F@home.com>,
> Michael Carman <mjcarman@home.com> wrote:
> >Steven O'Driscoll wrote:
> >>
> >> problem is that I can't display highlighted text it displays 4 of
> >> each character, so options becomes ooooppppttttiiiioooonnnnssss.
[snip]
> >
[snip]
>
> I think what they're saying is that they're using the output of "man"
^^^
> (or "nroff"), and it does bold characters by printing them then
[snip]
> The simple solution to this problem to remove all backspaces and
> characters that follow them. This will remove both the underlines and
$ man col
;)
Martien
--
Martien Verbruggen |
Interactive Media Division | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: Tue, 15 Aug 2000 13:13:52 +0200
From: "Marr, Lincoln [HOOF:4713:EXCH]" <lincolnmarr@europem01.nt.com>
Subject: Re: Cookie refresh problem under netscape commmunicator
Message-Id: <399925F0.2301A391@europem01.nt.com>
Hello, is there any Perl in this question?!?!
John Gold wrote:
>
> Hi,
> not sure if this is the right list but I have a problem refreshing a cookie
> under netscape navigator, works fine in explorer, strangely I appear to be
> recieving the cookie values from the cache and not the cookie under
> navigator, does anybody have any suggestions, or is this a known bug?
>
> thanks,
>
> John
>
> email john@kr8.com
------------------------------
Date: 15 Aug 2000 05:03:08 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Dangers of older perl (was Re: rand() not random at all)
Message-Id: <m1vgx2ybnn.fsf_-_@halfdome.holdit.com>
>>>>> "Ilmari" == Ilmari Karonen <iltzu@sci.invalid> writes:
Ilmari> In article <3998FE09.9BB9C9A1@remove_this_from_address.helsinki.fi>, Jonne Viljanen wrote:
>>
>> It seemed that the 5.003 perl required the use of srand prior to rand().
Ilmari> I would like to humbly express my personal opinion that what perl
Ilmari> 5.003 needs is not srand(), but an upgrade.
I'll second that. 5.003 (and all prior perls) have known buffer
overflow problems. Remember the Internet Worm of 1988? Got around
(partially) by having known buffer overflow problems in common
software!
I'd dare say (and have said many times in class) that if you are
running any version of Perl prior to 5.004 (where the first concerted
effort was made to remove *all* known buffer overflow problems) on any
website, you are subject to having your site hacked in, no matter what
CGI you are running. Goes as well for any setuid script available to
your users.
And since this is a known fact, if you *do* get broken in and your
customers sue you and you're running an old Perl, you *don't* want to
be in court describing that you are running a known-security-hole
Perl. I've had enough court experience to be painfully aware of being
on the wrong end of a court action.
So, upgrade! Before you end up in court. There, enough said? :)
print "Just another convicted Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 15 Aug 2000 11:34:44 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: date and time in perl
Message-Id: <966335866.11873.0.nnrp-14.c3ad6973@news.demon.co.uk>
Marr, Lincoln [HOOF:4713:EXCH] wrote in message
<399907D3.E304A03B@europem01.nt.com>...
>Try this, I used it and it works beautifully:
>=============================================
<loads of stuff that could be replaced with >
$date = localtime();
Note- the helpful thing here is to say watch out for scalar and list
context.
Less confusingly perhaps ...
$date = scalar( localtime() );
or
print scalar( localtime() );
(sorry for the excess brackets(its a retentive thing))
------------------------------
Date: Tue, 15 Aug 2000 11:41:17 +0100
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Get ip from visitor
Message-Id: <39991E4D.5F8A1D8A@yahoo.co.uk>
rune@clamon.dk wrote:
> Hi,
> I want to get the ip-adress from the visitor on my homepage that
> executes my perl cgi-script. How is this possible?
>
> Regards,
> Rune Christensen - DK
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
The environment variable REMOTE_ADDR
The CGI variables are all listed at
http://hoohoo.ncsa.uiuc.edu/cgi-1.1/env.html
------------------------------
Date: Tue, 15 Aug 2000 11:46:49 GMT
From: fvw+usenet@var.cx (fvw)
Subject: Re: grep() optimisation
Message-Id: <966340309JDS.fvw@var.cx>
<399812c4.4a4c$27d@news.op.net> (mjd@plover.com):
>In article <966252069UBK.fvw@var.cx>, fvw <fvw+usenet@var.cx> wrote:
>><3997cde7.3c98$31e@news.op.net> (mjd@plover.com):
>>>In article <966231197VVC.fvw@var.cx>, fvw <fvw+usenet@var.cx> wrote:
>>[snip good solution for a different case]
>>
>>My apologies, I have not been clear enough. My data always consists
>>of 6 colon-terminated strings,
>
>Then what about my second suggestion?
I didn't have access to the code when I replied to your suggestion,
so I pushed it onto my todo... Just tested it, and it's now running
at a lovely 4 secs! thanks.
--
Frank v Waveren
fvw@var.cx
ICQ# 10074100
------------------------------
Date: Tue, 15 Aug 2000 12:00:57 GMT
From: fvw+usenet@var.cx (fvw)
Subject: Re: grep() optimisation
Message-Id: <966341168DAO.fvw@var.cx>
<slrn8pg4lt.tj3.abigail@alexandra.foad.org> (abigail@foad.org):
>Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDXL September
>MCMXCIII in <URL:news:8n8ra8$ev4$1@lublin.zrz.tu-berlin.de>:
>`` fvw <fvw+usenet@var.cx> wrote in comp.lang.perl.misc:
>`` ><3997cde7.3c98$31e@news.op.net> (mjd@plover.com):
>`` >>In article <966231197VVC.fvw@var.cx>, fvw <fvw+usenet@var.cx> wrote:
>`` >[snip good solution for a different case]
>`` >
>`` >My apologies, I have not been clear enough. My data always consists
>`` >of 6 colon-terminated strings, followed by a string that I have to
>`` >check for matching of substrings. so tr/:// would end up always end up
>`` >>=6. The reason I've added the ([^:]:){6} to the beginning of the regexp
>`` >is to stop anything from $b from matching anywhere in the first fields
>`` >of the string. After advice from someone in this group, I've already
>`` >added a ^ to the beginning of it (resulting in a huge speed gain), which
>`` >might make it a bit more clear that all I want to do is ignore the first
>`` >six colon-terminated fields, while still preserving them in the result
>`` >of the grep().
>``
>`` In that case you may be able to save some time if you prepare a
>`` secondary array with the colon-containing prefix chopped off once
>`` and for all. That way, m/^([^:]:){6}/ will only have to run once
>`` for each of the strings.
>
>And if the number of digits between the colons is always the same, clever
>use of substr() or pos() eliminates the use of that regex.
Yes, substr prolly would have been a good idea, but now that I'm using
split, doing substr first and splitting the result to get the url out of
the way is actually a slowdown :-(.
--
Frank v Waveren
fvw@var.cx
ICQ# 10074100
------------------------------
Date: Tue, 15 Aug 2000 12:19:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Help: libs with Latin-1 or Unicode?
Message-Id: <Pine.GHP.4.21.0008151208240.21340-100000@hpplus03.cern.ch>
On Mon, 14 Aug 2000 eli@panix.com wrote:
> You wrote in comp.lang.perl.misc:
> > If you're dealing with coded character data, then a given file is
> > meant to be in one and only one character coding. If it's utf-8 then
> > it can't also be iso-8859-1 and vice versa. The idea of having a data
> > stream that suddenly switches from say utf-8 to say iso-8859-7 just
> > isn't considered.
>
> But how to implement the <LANG> tag of HTML 4.0 then?
According to HTML standards, the language of a document has absolutely
no relationship to the character coding. They are two totally
independent factors.
> using mail since this is offtopic in c.l.p.misc
Understood.
But what actually is your question? The HTML cannot be parsed at all
without having a working knowledge of what coding is in use, although
in practice if the coding isn't known then it can initially be parsed
as us-ascii, and this suffices until some further evidence is found,
e.g a META HTTP-EQUIV that specifies CHARSET, or a Byte Order Mark
that identifies it as one of the codings of unicode.
Would you find this page helpful, I wonder?
http://ppewww.ph.gla.ac.uk/~flavell/charset/quick
cheers
------------------------------
Date: Tue, 15 Aug 2000 12:24:36 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Help: libs with Latin-1 or Unicode?
Message-Id: <Pine.GHP.4.21.0008151220010.21340-100000@hpplus03.cern.ch>
[posted and emailed]
On Tue, 15 Aug 2000, Alan J. Flavell wrote:
(in the mistaken belief that I was composing an email reply)
> > using mail since this is offtopic in c.l.p.misc
>
> Understood.
Oh dear, I'm sorry, your email headers seem to have fooled my
software into posting a usenet followup instead of an email reply,
after all.
Please accept my apologies for the confusion, which I only noticed
when it was too late.
------------------------------
Date: Tue, 15 Aug 2000 10:15:21 GMT
From: "Pekka Siiskonen" <psi@nospam.mikrolog.fi>
Subject: Re: How to change Popup frame's URL
Message-Id: <ZK8m5.107$vY.8731@read2.inet.fi>
"Colin Keith" <newsgroups@ckeith.clara.net> wrote in message news:NwRl5.123>
> *sigh* Please, don't do this. This question has *nothing* to do with Perl.
> The fact that the program producing this HTML is written in Perl is
> entirely irrelevant to this question.
Sorry to upset! The problem is not with the enviroment, nor browser, nor
outlook! it is about the way CGI.pm sends form parameters by default.
I choose an example that all can access (Stein's site!) instead of my own
script, so that one may also verify that the popup window has the same URL
as the original. The outlook mailing thing was a proof of the fact that the
URL of the popup window created with CGI.pm is not related to the form
output, and that the form query parameters are sent by default as GET, not
as POST.
The question is: How to create a form that sends the form query parameters
as POST? Clickable hot link will not alone do, as the contents of the hot
link should be changed according to the way the form on same page is filled
(or an intermediate page should be created with the form that has the
cklickable hot link formulated accordingly).
This, as well as news:comp.infosystems.www.authoring.cgi were mentioned as
dicussion groups concerning CGI.pm related matters on
http://stein.cshl.org/WWW/software/CGI/ (propably more than this group!).
Again, sorry to cause nuisance!
Pekka Siiskonen
------------------------------
Date: Tue, 15 Aug 2000 10:26:53 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: map | grep
Message-Id: <pq5ipscre12k5q6v8gendfe2l2hk2fb52e@4ax.com>
johnvert@my-deja.com wrote:
> my %t=grep { $_ => "foo" } @list;
Heh?
You don't seem to grasp the basic idea behind grep(). It is to filter
out data, so the stuff in the block shoudl evaluate to a boolean, a "yes
or no" value. You've got a list there of two items. I can only assume
that grep() evaluates them in a scalar context, so that boolean is
"foo", which is true. Result: you get the same list out as you get in.
An example of what it's for:
@odd = grep { $_ & 1 } 1 .. 10;
print "@odd\n";
The block is executed for each item in turn, with $_ set to the item.
Only those items for which ($_ & 1) is not zero, get through. These are
the numbers with the lower bit set: the odd numbers.
By contrast, map BLOCK LIST does NOT filter. It does something simpler.
It still executes the block for each item in turn set, $_ set to that
item, but it passes no judgement on the result. Instead, it returns the
item(s) that the block returns, into the huge flat list of all results.
A simple example:
@twice = map { 2*$_ } 1 .. 10;
For each item, it is replaced in the result with its double.
It's more powerful than that: you can return a list, i.e. not just one,
but also zero, or two or more items. Your function is an example of
that.
@stutter = map { $_, $_ } 1 .. 10;
It can be used to populate a hash, because a hash can be populated froma
list, with two values: a key and a value, per item.
--
Bart.
------------------------------
Date: 15 Aug 2000 11:47:47 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Multiline regexp search and replace?
Message-Id: <8nbal3$h5g$1@lublin.zrz.tu-berlin.de>
<henrik.jonsson@se.adtranz.com> wrote in comp.lang.perl.misc:
>Hi,
>
>I am trying to make a search and replace in a multiline string but I
>can't get it to work.
>
>I have a textbox where the user can enter a description for a file.
>This description is then stored in a text file with a single record per
>line. But in order to store the record on one line I need to replace
>the \n with <br>'s.
>
>I tried s/\n/<br>/gs but it didn't work.
Probably because the lines you get back from the text box are terminated
with "\b\n".
Anno
------------------------------
Date: Tue, 15 Aug 2000 12:49:06 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Multiline regexp search and replace?
Message-Id: <spif22hekn933@corp.supernews.com>
In article <8nao1n$9r5$1@nnrp1.deja.com>,
<henrik.jonsson@se.adtranz.com> wrote:
: I have a textbox where the user can enter a description for a file.
: This description is then stored in a text file with a single record per
: line. But in order to store the record on one line I need to replace
: the \n with <br>'s.
:
: I tried s/\n/<br>/gs but it didn't work.
"Didn't work" is an unhelpful description (especially with no small bit
of code to examine). What were the results of the substitution?
Greg
--
Join the Army: travel to exotic distant lands; meet exciting, unusual people,
and kill them.
------------------------------
Date: 15 Aug 2000 12:35:43 GMT
From: a.peacock@chime.ucl.ac.uk (Anthony Peacock)
Subject: Re: need help with msql and perl
Message-Id: <8nbdev$mkg$1@uns-a.ucl.ac.uk>
In article <8nar9b$8gd$1@slb7.atl.mindspring.net>, hello@hello.com says...
>
>i am writing a script using the dbd::msql driver to access a small msql db.
>the prob i have is with a query i am trying to process. here is the code
>for it:
>
>my $dbh=DBI->connect($db, $dbName);
>my $statement= "select mov_index, mov_title, mov_year,mov_rating from movie
>where mov_avail= 'Y' \g";
>my $sth=$dbh->prepare($statement);
>
>for some reason the query won't execute when i call $sth->execute. i get
>parse errors. what is wrong with this?
It is a while since I used mSQL (now using mySQL) but I if my memory serves me
right, you don't need the '\g' in your SQL when using the DBI interface. The
'\g' is only needed when using the command line interpreter.
Also you should check the return values of both the connect and the execute
method calls. A simple example would be [untested]:
my $sth=$dbh->prepare($statement) || die "Error in execute - $DBI::errstr" ;
The $DBI::errstr will print out the exact text of the DBI error, this will
help debug any problems.
------------------------------
Date: 15 Aug 2000 12:33:32 GMT
From: mgjv@martien.heliotrope.home (Martien Verbruggen)
Subject: Re: Negativity in Newsgroup
Message-Id: <slrn8pidbm.4ap.mgjv@martien.heliotrope.home>
On Tue, 15 Aug 2000 04:00:35 GMT,
Joe C. Hecht <joehecht@code4sale.com> wrote:
>
> [sigh] I could not see them anyway, as I work
> all night in the Florida moonlight, either on the
> boat, the dock, or the hottub. I like the hottub
> cause it has a fast eithernet connection.
eithernet? ornet? You better make sure you have some good switches.
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd. | Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Tue, 15 Aug 2000 08:45:37 -0400
From: John Porter <john.porter-1@ksc.nasa.gov>
Subject: Re: Negativity in Newsgroup
Message-Id: <39993B71.1014998A@ksc.nasa.gov>
Wow!
I used newsgroups as a valuable resource for many years prior to this
newfound "WWW" thing. While there was certainly a subset of posters who
simply wrote to flame and provoke, the signal to noise ratio was usually
pretty good. Tolerence was high because we were all pretty new at this and
trying to spread the knowledge (about whatever subject) was the point.
Then along came the web and people started gaining access to what had
previously been a fairly closed community. The signal to noise ratio
became intolerable and I simply stopped using the newsgroups. For the 5%
of relevant posts I had to wade through the other 95% of "you're an
idiot"/"no, you are" posts. Search engines became efficient & I was able
to find the information I needed pretty much on my own. I didn't even have
a news reader on any of my machines for more years than I care to admit.
I recently picked up Perl. I have found it to be an efficient, powerful,
and fun language. I am able to provide value-added to my users
(particulary when combined with Tk) after a very short learning cycle.
Looking at the open nature of the community on the web (which, in my
opinion, is a diferent thing than the newsgroups) I assumed that the
newgroups would be a good place to pick up pointers and general knowledge,
as well as generating some person-to-person dialogs. I was astonished at
the number of postings I found (I first came in yesterday) and, quite
frankly, this lengthy thread scares the hell out of me. I had thought
better of the Perl community, based upon my limited experience surfing the
web pages out there.
I have seen some examples of the just plain meanness that has been talked
about in this thread. I have also seen some examples of some very helpful
people. I have always lived by the creed "There's no such thing as a
stupid question". Apparently, I'm in the minority...at least in this
group.
Well...back to lurking. I'm sure going to be careful about the questions
I post in this forum. Seems like a shameful waste of great potential.
Pity.
Jp
------------------------------
Date: Tue, 15 Aug 2000 11:45:12 +0100
From: Alex Buell <alex.buell@tahallah.clara.co.uk>
Subject: Passwords
Message-Id: <6o7ipsol0ggc22lmmnergknhhgihd8q4tm@4ax.com>
Other than using system("stty -echo") and system("stty echo"), are
there any other ways of concealing passowrds being entered?
Cheers,
Alex.
--
Bring on the music and lights!
http://www.tahallah.clara.co.uk
------------------------------
Date: Tue, 15 Aug 2000 08:37:10 -0400
From: "wu.s" <valued_customers@emai.com>
Subject: Pattern match - Extract info from a page
Message-Id: <8nbdhs$2v4g$1@msunews.cl.msu.edu>
Hello,
Could someone share a piece of code or point me to another source? I want to
index job information that posted on serveral different websites. Suppose I
download the following HTML page:
<html>
<body>
.....
<table>
<tr><td>Title 1</td>
<td> Category 1 </td>
<td> <a href="detail1.html" Detail 1 </a> </td>
</tr>
<tr><td> Title 2 </td>
<td> Category 1</td>
<td> <a href="detail2.html" Detail 2 </a></td>
</tr>
......
</table>
</body>
</html>
How do I extract the three parts and save them into a text file:
Title 1 | Category 1 | detail1.html
Title 2 | Category 2 | detail2.html
......
Thank you very much.
Daniel
------------------------------
Date: 15 Aug 2000 12:03:58 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Perl to excel
Message-Id: <966340444.22787@itz.pp.sci.fi>
In article <398F18BB.4A149C2F@vpservices.com>, Jeff Zucker wrote:
>
>Write the output as a CSV (comma separated values, "comma delimited")
>file which Excel can read automatically. Or use Spreadsheet::WriteExcel
>on CPAN.
I'd recommend the latter approach, with the disclaimer that I've never
used it in practice myself. If you do go with the former, it might be
a good idea to give the output files a .txt extension, instead of .csv,
since that will make Excel start the Text Import Wizard which lets you
control the parsing process. Otherwise Excel may try to automatically
convert values that look numeric into floats, possibly corrupting them.
Cool, bricktext!
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Tue, 15 Aug 2000 12:34:00 +0200
From: "Felix Brack" <fb@ltec.ch>
Subject: Problem with IIS4
Message-Id: <39991cfb@news.datacomm.ch>
I just setup Perl on a IIS4 server. When I type the name of
a perl script at the commandline on the server, perl.exe takes
the script and everything comes out fine.
When I want to run the same perl script from within a html page,
perl.exe does not seem to run, since the data returned is just
the contents of the perl script, not the output perl.exe should generate
from my script.
A simple script is the following one:
print "Content-type: text/html\n\n";
print "<html>\n";
print "<head><title>Perl Script 'Submit'</title></head>\n";
print "<body>\n";
print "<H2> Some Heading 2<p>\n";
print "</body>\n";
print "</html>\n";
Calling it from within a html page I get:
print "Content-type: text/html\n\n";print "\n";print "\n";print "\n";print "
Some Heading 2
\n"; print"\n"; print"\n";
I have verified that perl is installed correctly and that execution of
scripts is enabled.
Must be a silly error, but I do not know where to search for the problem.
Any idea?
Many thanks in advance, Felix
--
-----------------------------------
Felix Brack
LTEC AG
Dorfgasse 10
CH-4435 Niederdorf
SWITZERLAND
Internet: http://www.ltec.ch
Tel. +41 61 963 14 14
Fax. +41 61 963 14 13
E-Mail: fb@ltec.ch
------------------------------
Date: Tue, 15 Aug 2000 13:43:45 +0200
From: Uwe Doetzkies <Uwe.Doetzkies@Dresdner-Bank.com>
Subject: strict and recursive functions
Message-Id: <39992CF1.437ABCE8@Dresdner-Bank.com>
i think, there must be a faq anywhere, but i didn't found it:
what is the problem to use strict and local simultaneous? look at this
script:
---
#!/usr/bin/perl
use strict;
my $val = shift;
print "$val! = ${\fak($val)}\n";
sub fak {
local $cur = shift;
return 1 if $cur == 1;
return $cur * fak ($cur-1);
}
---
the output is
Global symbol "$cur" requires explicit package name at fak.pl line 9.
Execution of fak.pl aborted due to compilation errors.
if no strict is used, it works. but i don't like perl without strict.
thanks in advance
uwe
------------------------------
Date: Tue, 15 Aug 2000 12:45:21 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: strict and recursive functions
Message-Id: <spier1b8kn9136@corp.supernews.com>
In article <39992CF1.437ABCE8@Dresdner-Bank.com>,
Uwe Doetzkies <Uwe.Doetzkies@Dresdner-Bank.com> wrote:
: #!/usr/bin/perl
:
: use strict;
:
: my $val = shift;
: print "$val! = ${\fak($val)}\n";
:
: sub fak {
: local $cur = shift;
: return 1 if $cur == 1;
: return $cur * fak ($cur-1);
: }
:
: the output is
:
: Global symbol "$cur" requires explicit package name at fak.pl line 9.
: Execution of fak.pl aborted due to compilation errors.
What did the perldiag manpage have to say about the error message?
Greg
--
The greatest dangers to liberty lurk in insidious encroachment by men
of zeal, well-meaning but without understanding.
-- Justice Louis D. Brandeis
------------------------------
Date: Tue, 15 Aug 2000 13:30:45 +0200
From: Jimmy Lantz <jimmy.lantz@ostas.lu.se>
Subject: translating tr/a-z/A-Z/ best or s/.....
Message-Id: <399929E5.43CDCCA@ostas.lu.se>
Hi,
which is the fastet and the most secure /*reliable*/ way to do this(see
code below)
The correct values of $some_code could be as follow
KIN231
KIN221d
OSH765
OSH765h
########### Working code
#!perl
$some_code = 'Kin231D'; #exampel of incorrect value to be changed
$some_code =~ /\d\d\d/;
$a = $`;
$b = $&;
$c = $';
$a =~ tr/a-z/A-Z/;
$c =~ tr/A-Z/a-z/;
$some_code = $a . $b . $c;
print $some_code;
exit;
Is there any faster solution without having to use $` $& $'
I 'v heard that they can slow the process down a little.
/ Jimmy L.
------------------------------
Date: Tue, 15 Aug 2000 14:06:26 +0200
From: "Brendon Caligari" <bcaligari@shipreg.com>
Subject: Re: translating tr/a-z/A-Z/ best or s/.....
Message-Id: <8nbb37$sk9$1@news.news-service.com>
"Jimmy Lantz" <jimmy.lantz@ostas.lu.se> wrote in message
news:399929E5.43CDCCA@ostas.lu.se...
> Hi,
> which is the fastet and the most secure /*reliable*/ way to do this(see
> code below)
> The correct values of $some_code could be as follow
> KIN231
> KIN221d
> OSH765
> OSH765h
>
> ########### Working code
> #!perl
> $some_code = 'Kin231D'; #exampel of incorrect value to be changed
> $some_code =~ /\d\d\d/;
>
> $a = $`;
> $b = $&;
> $c = $';
> $a =~ tr/a-z/A-Z/;
> $c =~ tr/A-Z/a-z/;
>
> $some_code = $a . $b . $c;
> print $some_code;
> exit;
>
> Is there any faster solution without having to use $` $& $'
> I 'v heard that they can slow the process down a little.
> / Jimmy L.
$some_code = uc($some_code);
or
$some_code =~ tr/a-z/A-Z/;
------------------------------
Date: 15 Aug 2000 12:47:05 +0100
From: nobull@mail.com
Subject: Re: translating tr/a-z/A-Z/ best or s/.....
Message-Id: <u9n1ieoifa.fsf@wcl-l.bham.ac.uk>
Jimmy Lantz <jimmy.lantz@ostas.lu.se> writes:
> Subject: Re: translating tr/a-z/A-Z/ best or s/.....
Personally I'd use the built-in uc() function or the \U interpolation
escape.
> which is the fastet and the most secure /*reliable*/ way to do this(see
> code below)
>
> The correct values of $some_code could be as follow
> KIN231
> KIN221d
> OSH765
> OSH765h
>
> ########### Working code
> #!perl
> $some_code = 'Kin231D'; #exampel of incorrect value to be changed
> $some_code =~ /\d\d\d/;
>
> $a = $`;
> $b = $&;
> $c = $';
> $a =~ tr/a-z/A-Z/;
> $c =~ tr/A-Z/a-z/;
>
> $some_code = $a . $b . $c;
> print $some_code;
> exit;
>
> Is there any faster solution without having to use $` $& $'
#!/usr/bin/perl -w
use strict;
my $some_code = 'Kin231D';
$some_code =~ s/^(.*)(\d{3})(.*)$/\U$1$2\L$3/;
print $some_code;
__END__
I've not benchmarked this but it's almost certainly faster. It's
certainly neater.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 15 Aug 2000 14:44:10 +0200
From: "Thoren Johne" <thoren@southern-division.com>
Subject: Re: translating tr/a-z/A-Z/ best or s/.....
Message-Id: <8nbdvh$9hf$13$1@news.t-online.com>
Jimmy Lantz <jimmy.lantz@ostas.lu.se> wrote in message
news:399929E5.43CDCCA@ostas.lu.se...
> which is the fastet and the most secure /*reliable*/ way to do this(see
> code below)
> The correct values of $some_code could be as follow
> KIN231
> KIN221d
> OSH765
> OSH765h
>
> ########### Working code
> #!perl
> $some_code = 'Kin231D'; #exampel of incorrect value to be changed
> $some_code =~ /\d\d\d/;
>
> $a = $`;
> $b = $&;
> $c = $';
> $a =~ tr/a-z/A-Z/;
> $c =~ tr/A-Z/a-z/;
>
> $some_code = $a . $b . $c;
> print $some_code;
> exit;
>
what about:
$some_code =~ s/(\w+?)(\d{3})(\w?)/uc($1) . $2 . lc($3)/e;
gruß
thoren
8#X
--
----------------------------------------------------------------------
Thoren Johne - 8#X - thoren@southern-division.com
Southern Division Classic Bikes - www.southern-division.com
------------------------------
Date: Tue, 15 Aug 2000 11:44:20 +0100
From: Alex Buell <alex.buell@tahallah.clara.co.uk>
Subject: What's the best way to overwrite a string with '*?
Message-Id: <oj7ips41l5q3e1mciqtoe91t4i3e5rh571@4ax.com>
For example, I have a string 'Hello world, I am 29!' that I want to
overwrite with '*' (asterisks) such that it becomes the following:
'*********************'.
What's the best way to do this?
Cheers,
Alex.
--
Bring on the music and lights!
http://www.tahallah.clara.co.uk
------------------------------
Date: Tue, 15 Aug 2000 13:34:52 +0200
From: "Brendon Caligari" <bcaligari@shipreg.com>
Subject: Re: What's the best way to overwrite a string with '*?
Message-Id: <8nb981$ra5$1@news.news-service.com>
"Alex Buell" <alex.buell@tahallah.clara.co.uk> wrote in message
news:oj7ips41l5q3e1mciqtoe91t4i3e5rh571@4ax.com...
> For example, I have a string 'Hello world, I am 29!' that I want to
> overwrite with '*' (asterisks) such that it becomes the following:
> '*********************'.
>
> What's the best way to do this?
>
how have you tried to solve the problem?
have you tried substituting 'any character' to a '*'....or say, creating a
string of
the same length of the original only full of '*'s?.....or maybe translating
any character
to a '*'?
Brendon
++++
------------------------------
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 4021
**************************************