[11119] in Perl-Users-Digest
Perl-Users Digest, Issue: 4719 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 22 07:06:41 1999
Date: Fri, 22 Jan 99 04:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 22 Jan 1999 Volume: 8 Number: 4719
Today's topics:
Re: Browser History with Perl rupert@no.spam.leeds.ac.uk
Re: dereference entire array of array references (Bart Lateur)
Re: Difficult issues not suitable for this newsgroup? <richardsonja@logica.com>
Re: gethostbyname troubles <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Help with RE for separate Perl codes and comments (Bart Lateur)
How to call an external cgi script by perl? <adam@adam.com>
Re: Is there an HTML to CGI.pm converter?? <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Is there an HTML to CGI.pm converter?? (Bart Lateur)
Re: Memory management (Sam Holden)
Re: Oracle from Linux <rolf@parallax.co.uk>
Perl ressources <kar@webline.dk>
Re: Perl uses in NT <carvdawg@patriot.net>
Re: Please help me to use sockets (Bart Lateur)
preserve the case of a string (Jason Q.)
Re: Safely editing /etc/passwd. jbritain@home.com
string to integer conversion <mayo98@portalinc.com>
Re: string to integer conversion <ebohlman@netcom.com>
Re: The Documeantion (was Re: Perl problem :(Offline mo <andrewf@beausys.demon.co.uk>
Re: The Documeantion (was Re: Perl problem :(Offline mo (Sam Holden)
Re: URGENTLY want some help (Sam Holden)
Re: URGENTLY want some help <partha@mihy.mot.com>
Re: URGENTLY want some help (Sam Holden)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 22 Jan 1999 09:42:48 +0000 (GMT)
From: rupert@no.spam.leeds.ac.uk
Subject: Re: Browser History with Perl
Message-Id: <36A8B923.5554@no.spam>
> Bob Tate (btate@primary.net) wrote on MCMLVIII September MCMXCIII in
> <URL:news:36991a93.0@news.primary.net>:
> <> Looking for a way to view the browser history with Perl so that I
> <> can see the last page visited before getting to my page.
>
> Since you don't give any information about your browsing situation,
> I propose 'open MEM, "/dev/mem" or die $!;' and start from there.
>
If you go to CPAN you may find the Netscape modules. Whilst I don't
think this will directly solve the presented problem, you may find
them of interest in working with Perl and Netscape.
BEn.
------------------------------
Date: Fri, 22 Jan 1999 09:46:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: dereference entire array of array references
Message-Id: <36a8422b.2063092@news.skynet.be>
Lee Benfield wrote:
>*grin* foreach... he wanted one without a loop.
>That's neat though. :)
"map" is a loop too.
Bart.
------------------------------
Date: Fri, 22 Jan 1999 11:28:23 -0000
From: "James Richardson" <richardsonja@logica.com>
Subject: Re: Difficult issues not suitable for this newsgroup?
Message-Id: <789nd8$qon@romeo.logica.co.uk>
Jonathan Stowe wrote in message <7855si$14g$1@gellyfish.btinternet.com>...
>I dont mean to weird but much of the flaming that happens in this group
>is as a result of post like yours from people dissatisfied with the
>response they have met to some previous posting - especially at a time
>like this when it appears that all of the trolls in the world have
>descended upon the group and people lose their patience.
>
Sorry, not dissatisfied, for that would mean that I would be thinking of
usenet as some sort of consultancy, rather than giving their time and
expertise free. I think the word is rather more disappointed (and stuck on a
(to me) tricky one), cos (although far from being P++++ !) I have been doing
Perl for a while and always stumbled on the XS stuff, and felt that just a
small nudge in the right direction could get the mental block out of the
way... Still, I wrote the message after banging my head at the keyboard for
about 1/2 a day.... but unfortunately a new day didn't bring a new
understanding of how to do what I wanted....
By the way, just what is 'to weird', I've been puzzled by that one!
Cheers!
James
------------------------------
Date: 22 Jan 1999 11:30:25 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: gethostbyname troubles
Message-Id: <831zknd2gu.fsf@vcpc.univie.ac.at>
Re: gethostbyname troubles, Lee <rlb@intrinsix.ca>
said:
Lee> ($name, $aliases, $type, $length, @addrs)
Lee> = gethostbyname ($dn); print " dn: $dn\n";
Lee> print " n: $name\n"; print " a: $aliases\n";
Lee> print " t: $type\n"; print " l: $length\n";
Lee> print " #: $#addrs\n";
Lee> and the results:
Lee> dn: revelstoke-11.junction.net n:
Lee> revelstoke-11.junction.net a: t: 2 l: 4 #: 0
Lee> Yet the same name resolves to an ip# on the
Lee> same machine using nslookup, and the (lack of)
Lee> results are the same on four machines.
surely this is saying that @addrs contains 1 entry
(the maximum array index is 0). If you unpack it:
$dn = 'revelstoke-11.junction.net';
($name, $aliases, $type, $length, @addrs) = gethostbyname ($dn);
foreach $a (@addrs) {
$ip = join('.', unpack('C4', $a));
print "$ip\n";
}
==> 206.12.8.140
That looks right to me...
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Fri, 22 Jan 1999 11:28:34 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help with RE for separate Perl codes and comments
Message-Id: <36aa5b59.8508266@news.skynet.be>
Matthew Bafford wrote:
>If you wanted to be as close as possible (using a re), you could match a
># only if it doesn't follow tr, y, s, m, qq, q, qx, qw (I think I may have
>missed some), or a $ sign (I'm SURE I missed one (or more)).
Oh, yes. How about a "#" in a string. How about in HERE docs. ("<<").
Simple? What about if "#" follows a ";" with only whitespace between
them, or as the first thing on a line. Most people write comments that
way. It won't drop comments inside commented multiline regexes (/.../x),
though.
s/(^|;)\s*#.*/$1/;
As an aside:
>> $script =~ s/\#.*\n//g;
You don't really want to drop the newline.
Bart.
------------------------------
Date: 22 Jan 1999 10:50:53 GMT
From: "adam" <adam@adam.com>
Subject: How to call an external cgi script by perl?
Message-Id: <01be45f6$f628e860$e0a4d690@VSTAA94.cityu.edu.hk>
Hi,
There is an external cgi script called java.cgi, how to execute it within a
perl script?
Thx for your help.
Cliff
------------------------------
Date: 22 Jan 1999 11:23:04 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Is there an HTML to CGI.pm converter??
Message-Id: <833e53d2t3.fsf@vcpc.univie.ac.at>
Re: Is there an HTML to CGI.pm converter??, Jete
<jete@dgs.dgsys.com> said:
Jete> We have reams and reams of HTML code which
Jete> needs to be converted so that it is expressed
Jete> in terms of CGI.pm code. Is there a converter
Jete> which will accept a file of HTML code and
Jete> produce the appropriate calls to CGI.pm
Jete> routines to produce output which is identical
Jete> to its HMTL input??
Like Abigail said, "print" would be the simplest. A
more `interesting' solution would be
HTML::TreeBuilder to slurp the original document and
if you need to do fancy things with the HTML you can
HTML::Parser it.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Fri, 22 Jan 1999 11:23:47 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Is there an HTML to CGI.pm converter??
Message-Id: <36ac5f59.9532673@news.skynet.be>
Jete Software Inc. wrote:
>We have reams and reams of HTML code which needs to be converted so
>that it is expressed in terms of CGI.pm code. Is there a converter
>which will accept a file of HTML code and produce the appropriate
>calls to CGI.pm routines to produce output which is identical to its
>HMTL input??
That's one of the reasons why I don't use CGI.pm. I use HTML templates
(plus a reduced library, < 8k) instead. Substitute fields in the
template with their value, and print out the result.
It did take me a while to get "repeatable sections" right.
Bart.
------------------------------
Date: 22 Jan 1999 10:02:53 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Memory management
Message-Id: <slrn7agj6d.n86.sholden@pgrad.cs.usyd.edu.au>
On Fri, 22 Jan 1999 13:12:49 +0530, Ramanujam Parthasarathi
<partha@mihy.mot.com> wrote:
>Hi,
>
>I have a query on how and when does PERL do memory management. I want to
>know when does it free the memory - more correctly, how does it know
>when to free the memory being used by a variable. This query becomes
>more important when we use references (named or anonymous) inside
>references - say in a class (OO Perl).
It uses simple reference counting... so just don't make circular refs...
Of course 'man perl' implies that with
'Perl manages your reference counts for you' so you should have been able
to read the manual and guess. I'm sure a README somewhere must say this,
and most books...
--
Sam
Fifty years of programming language research, and we end up with C++ ???
--Richard A. O'Keefe
------------------------------
Date: Fri, 22 Jan 1999 10:40:06 +0000
From: Rolf Howarth <rolf@parallax.co.uk>
Subject: Re: Oracle from Linux
Message-Id: <36A85586.12CB50FD@parallax.co.uk>
"Christian M. Aranda" wrote:
>
> On Thu, 21 Jan 1999 16:49:17 +0000, Rolf Howarth <rolf@parallax.co.uk>
> wrote:
> >Why is there no . . .
>
> perl questions in sight?
Well, I actually wrote "What's the easiest way to connect to an Oracle
database (on NT) from
Perl (on Linux)?", but we'll let that stand.
Perhaps I should clarify my question then: are there any pure PERL
implementations (not requiring native C/C++ libraries, or invoking a
JVM) of any net protocol (SQL*Net? JDBC?) that will let a Perl client
talk to an Oracle server without requiring any extra software to be
installed on the server? Is that a Perl question?
-Rolf
------------------------------
Date: Fri, 22 Jan 1999 11:22:53 +0100
From: Kaare Rasmussen <kar@webline.dk>
Subject: Perl ressources
Message-Id: <36A8517D.C5E3C06C@webline.dk>
Any other valuable ressources than CPAN? I'm especially looking for
one-liners that actually do something useful.
------------------------------
Date: Fri, 22 Jan 1999 05:58:03 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Perl uses in NT
Message-Id: <36A8136B.2BD37546@patriot.net>
> > > Mike wrote in message <773m45$dt0$1@nnrp03.primenet.com>...
> > > >Hi, I'm new to the Perl world. My boss, a unix administrator, suggested I
> > > >learn some Perl and apply it to my NT administration. Could anyone show me
> > > >where I could find some good examples or situations where I could use Perl
> > > >in NT?
- MD5 checksums
- EventLogging...both generating and reading/archiving
- Security assessment tools
- Port Listener...waiting for skript kiddies to come looking for BO and NetBus
I have toyed with writing a small daemon for workstations and running them
as a service, a la port 15 on VAX/VMS systems. If you block the port you
use at the firewall, and are on a relatively small LAN with trusted users,
this shouldn't be a problem...
------------------------------
Date: Fri, 22 Jan 1999 09:46:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Please help me to use sockets
Message-Id: <36ab459d.2944913@news.skynet.be>
Eric Bohlman wrote:
>Bart Lateur <bart.lateur@skynet.be> wrote:
>
>: use LWP::Simple;
>: ($content_type, $document_length, $modified_time, $expires,
>: $server) = get('http://www.any.any/directory/page.any');
>
>Typo alert. That should be head, not get.
Oops, you're right. I've had trouble with formatting the code text, due
to line wrapping, so I ended up mixing up the functions. The left side
clearly is the recipient for head().
>since some servers will process GET requests but not HEAD requests, so if
>a HEAD fails it's necessary to try a GET.
Note that the LWP docs say that get() strips of the content headers,
while those headers are all you need for this application.
Bart.
------------------------------
Date: Fri, 22 Jan 1999 11:01:17 GMT
From: pigs_can_fly@mindless.com (Jason Q.)
Subject: preserve the case of a string
Message-Id: <36b35a2b.36819230@news.cyberway.com.sg>
When printing a $string, I'd like the @keywords to be of a different colour.
This is the code I'm using right now
---------------------------------------------------------------------
@keyword = ("einstein", "newton", "curie");
$string = "Albert Einstein, Isaac Newton, Marie Curie";
foreach (@keyword)
{
$string =~ s/$_/<FONT COLOR=DARKRED>$_<\/FONT>/gi;
}
print $string;
---------------------------------------------------------------------
However, because I'm replacing $_ with $_ , the printed string comes out like this:
"Albert einstein, Isaac newton, Marie curie"
How would I be able to preserve the original case of the $string and still change it's colour?
Any help would be appreciated. Thanks.
Jason Q.
------------------------------
Date: Fri, 22 Jan 1999 11:17:36 GMT
From: jbritain@home.com
Subject: Re: Safely editing /etc/passwd.
Message-Id: <36a85939.16433378@news>
On Fri, 22 Jan 1999 07:15:05 GMT, Steve Vertigan
<vertigan@iinet.net.au> wrote:
>I'm writing a perl script that will run from cron, read information from
>files and update the /etc/passwd file. Touching the /etc/passwd file has
>given me the screaming heebie jeebies ever since I blanked out a machines
>entire passwd file once so I'm wondering if people can point out any
>deficiencies in my procedure.
>
>(1) Email with add/remove/modify instructions are sent to an email alias
>from a cgi script. This is filtered through to a perl script which checks
>that a valid password has been supplied to authorise the procedure and also
>that the user being changed is allowed (ie. not root). Will eventually use
>pgp but is plaintext for the moment although the authorisation password is
>never written to a file.
>
>(2) Perl script runs from cron, read information in files that the first
>script has written. Doesn't do any checking, just obeys orders. It loads
>/etc/passwd into an array, makes modifications, writes array to
>/etc/passwd2. If /etc/passwd2 exists and has a file size > 0 call
>system("cp /etc/passwd2 /etc/passwd");
>
>My main question is are there any modules or procedures I can use to verify
>the integrity of /etc/passwd2 before copying other than checking for it's
>existence and > 0 size? I've included the system overview in case someone
>wants to scream "DON'T DO THAT YOU FOOL!" :-) The directory that "command"
>files are written to is only readable/writeable to the user that owns it
>(which recieves mail and writes a file assuming password was correct). I
>figure the only way someone can write files in here is if they have root
>access to start with. All operations are reported to the person who sent
>the mail and an administrator who's address is hardcoded into the scripts
>itself. Is this workable?
1. Copy the file, and work on the copy, not the original, make a
second copy, and save it to a date/time serialized file for backup.
2. Since it's only changing a password, the file character count
(size) should be exactly the same, and you can in fact "edit in place"
if the whole file will fit in memory at once.
3. either with a cron job, do a weekly wipeout of old backups, (of
course this will depend upon number of changes/week, etc.) but it
leave you a fallback position. Save the backups root-owned, mod 0400.
4. sort the file by UID, before saving it to an intermediate temporary
passwd file in the destination directory. chmod the original passwd
file so that it can be eliminated, and then mv the new passwd.tmp in
place. chmod the finally written passwd file to 0444, and chown, and
chgrp it, just for insurance.
5. Consider, that you may need to make the original temporarily
unavailable to prevent other users from doing simultaneous updates of
their accounts while the process is running.
Timing, and sequence is everything, as well as comparison of old and
new file (byte count, and character difference -- 13 characters) on
similarly sorted lines.
Another method to use, since the character space is fixed, is copy,
seek, and replace characters in place in the new copy. -- especially
for largish files...
------------------------------
Date: Fri, 22 Jan 1999 19:32:55 +0800
From: "James" <mayo98@portalinc.com>
Subject: string to integer conversion
Message-Id: <789mvj$8ff$1@news.ncal.verio.com>
Sirs,
Hi.. I'm new to perl. I would like to know how will i Convert a string
number "47" to integer number 47 ?? For example, I have this program that
adds 2 to "47". So i have to convert "47" to 47 then add 2 to make it 49
then convert it back to "49" string.. how ??
thanx for any help u can give me..
James
------------------------------
Date: Fri, 22 Jan 1999 11:43:10 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: string to integer conversion
Message-Id: <ebohlmanF5yLvy.AAC@netcom.com>
James <mayo98@portalinc.com> wrote:
: Hi.. I'm new to perl. I would like to know how will i Convert a string
: number "47" to integer number 47 ?? For example, I have this program that
: adds 2 to "47". So i have to convert "47" to 47 then add 2 to make it 49
: then convert it back to "49" string.. how ??
Perl will do that for you automatically. You don't need to do explicit
string/numeric conversions.
------------------------------
Date: Fri, 22 Jan 1999 10:27:35 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: The Documeantion (was Re: Perl problem :(Offline mode...)
Message-Id: <nTwGhAAXKFq2Ewk9@beausys.demon.co.uk>
In article <7854ev$14a$1@gellyfish.btinternet.com>, Jonathan Stowe
<gellyfish@btinternet.com> writes
>On Wed, 20 Jan 1999 09:59:42 +0000 Andrew Fry wrote:
>>
>> I am well aware of manuals, on-line docs, etc ... but I dont have
>> time to plough through lots of manuals/docs (do you ???), and I
>> know by experience that one doesnt always find what one is looking for
>> in documentation.
>
>I would certainly find time to search the appropriate documentation
>thoroughly before I asked a question of anyone.
Obviously you have more time on your hands than I do.
>
>And what do you get if search for 'debugging' in the CGI.pm manpage ?
>
>> The fact is that I run a small comms/networking consultancy & software
>> house ... and we work to very tight deadlines. Having the time to read
>> and learn is something of a luxury.
>
>And of course you have plenty of time to post a question to a newsgroup
>and wait for perhaps days or perhaps forever for a response.
It took me a matter of seconds to post my question, and I had replies
the same day. Dont exaggerate!
>Even given a
>fast newsfeed I doubt if this is more efficient than examining the
>appropriate documentation.
It can be. I myself have had replies to a number of questions quickly
via the newsgroups, after having spent a considerable amount of time
reading documentation only to find that it doesn't tell me what I want
to know.
>
>> I appreciate the helpful replies, but frankly, I dont see the point in
>> these discussion groups if the reply is just going to be 'read the
>> manual'!
>>
>
>I wont rehash the old fishing parable once again but the point is that it
>is more efficient to encourage to help themselves rather than rely on the
>help of others. The documentation and the FAQ is there in order to help
>people find the answers. Oh sure people could just sit by their computers
>and cut and paste sections of the documentation into their newsreaders in
>response to questions but what would that achieve ? If it is answered in the
>documentation then it is better to point someone to the appropriate item of
>documentation its as simple as that.
Well, if that's your view, why dont you just post a standard reply to
*every* query telling the poster to go and read the documentation ?
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: 22 Jan 1999 10:53:24 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: The Documeantion (was Re: Perl problem :(Offline mode...)
Message-Id: <slrn7agm54.nt0.sholden@pgrad.cs.usyd.edu.au>
On Fri, 22 Jan 1999 10:27:35 +0000, Andrew Fry <andrewf@beausys.demon.co.uk>
wrote:
>In article <7854ev$14a$1@gellyfish.btinternet.com>, Jonathan Stowe
><gellyfish@btinternet.com> writes
>>On Wed, 20 Jan 1999 09:59:42 +0000 Andrew Fry wrote:
>>>
>>> I am well aware of manuals, on-line docs, etc ... but I dont have
>>> time to plough through lots of manuals/docs (do you ???), and I
>>> know by experience that one doesnt always find what one is looking for
>>> in documentation.
>>
>>I would certainly find time to search the appropriate documentation
>>thoroughly before I asked a question of anyone.
>
>Obviously you have more time on your hands than I do.
Maybe they just don't assume that there time is much more valuable than
every body elses, and thus don't try to save a little of their time, at the
cost of a little of _lot's_ of other people's time...
>>> The fact is that I run a small comms/networking consultancy & software
>>> house ... and we work to very tight deadlines. Having the time to read
>>> and learn is something of a luxury.
>>
>>And of course you have plenty of time to post a question to a newsgroup
>>and wait for perhaps days or perhaps forever for a response.
>
>It took me a matter of seconds to post my question, and I had replies
>the same day. Dont exaggerate!
However, if you continue to treat this newsgroup as a helpdesk for
questions covered in the documentation, then when you have a question that is
shall we say difficult, the very people who might know the answers will have
you kill-filed.
>
>>Even given a
>>fast newsfeed I doubt if this is more efficient than examining the
>>appropriate documentation.
>
>It can be. I myself have had replies to a number of questions quickly
>via the newsgroups, after having spent a considerable amount of time
>reading documentation only to find that it doesn't tell me what I want
>to know.
>
>>
>>> I appreciate the helpful replies, but frankly, I dont see the point in
>>> these discussion groups if the reply is just going to be 'read the
>>> manual'!
>>>
>>
>>I wont rehash the old fishing parable once again but the point is that it
>>is more efficient to encourage to help themselves rather than rely on the
>>help of others. The documentation and the FAQ is there in order to help
>>people find the answers. Oh sure people could just sit by their computers
>>and cut and paste sections of the documentation into their newsreaders in
>>response to questions but what would that achieve ? If it is answered in the
>>documentation then it is better to point someone to the appropriate item of
>>documentation its as simple as that.
>
>Well, if that's your view, why dont you just post a standard reply to
>*every* query telling the poster to go and read the documentation ?
Soome people do actually manage to ask questions that are not covered in the
documentation. Others continue asking questions answered in the obvious
places to look (the faq, the perldoc for the module they're using, the
appropriate section of the perl docs, etc).
The problem is that people answer them, and then those wrong answers have to be
corrected. Take a look at the great way suggested to find the length of a
string : '$len = scalar(split(//,$string));'
What's wrong with '$len = length $string;' only the poster will know, but if
I ever have to maintain code that uses that construct I'll be sure to look
that poster up...
I can only dream of the day that people actually learn how to read manuals,
and don't get into the habit of asking in newsgroups for everything. Of course
if people keep answering them with more than a reference to the docs then it
will never happen...
--
Sam
comments on data are usually much more helpful than on algorithms
--Rob Pike
------------------------------
Date: 22 Jan 1999 10:06:16 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: URGENTLY want some help
Message-Id: <slrn7agjco.n86.sholden@pgrad.cs.usyd.edu.au>
On Fri, 22 Jan 1999 07:53:25 GMT, leostar@mailcity.com <leostar@mailcity.com>
wrote:
>Hello
> I just got my assignment from my professor. I'm new in Perl. and I don't
>know what function I can use for check string length and How to check whether
>all text in varable is pure numeric.
> Please help me. I have to finish it soon.
> Anyway, Thanks for dropping here.
RTFM and do your own homework...
--
Sam
"... the whole documentation is not unreasonably transportable in a
student's briefcase." - John Lions describing UNIX 6th Edition
"This has since been fixed in recent versions." - Kernighan & Pike
------------------------------
Date: Fri, 22 Jan 1999 15:31:37 +0530
From: Ramanujam Parthasarathi <partha@mihy.mot.com>
To: leostar@mailcity.com
Subject: Re: URGENTLY want some help
Message-Id: <36A84C81.86EB77E9@mihy.mot.com>
Hi,
I suggest you have a quick look at "man perlre".
To check if a string has all numbers you may use
if($string =~ /^\d*$/) { # you may need to remove white-space before this check
print "all numbers";
}
I don't think there's any function for string-length. Maybe you can split on the
string on a null string and then check for its size. Some thing like
$str_len = scalar(split(//, $string));
HTH
Partha
leostar@mailcity.com wrote:
> Hello
> I just got my assignment from my professor. I'm new in Perl. and I don't
> know what function I can use for check string length and How to check whether
> all text in varable is pure numeric.
> Please help me. I have to finish it soon.
> Anyway, Thanks for dropping here.
> Leo
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 22 Jan 1999 10:43:36 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: URGENTLY want some help
Message-Id: <slrn7aglio.nt0.sholden@pgrad.cs.usyd.edu.au>
On Fri, 22 Jan 1999 15:31:37 +0530, Ramanujam Parthasarathi
<partha@mihy.mot.com> wrote:
>I don't think there's any function for string-length. Maybe you can split on the
>string on a null string and then check for its size. Some thing like
>$str_len = scalar(split(//, $string));
Or maybe you could RTFM or have a guess as to what such a function might be
called...
--
Sam
Even if you aren't in doubt, consider the mental welfare of the person
who has to maintain the code after you, and who will probably put parens
in the wrong place. --Larry Wall
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4719
**************************************