[15734] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3147 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 24 14:05:50 2000

Date: Wed, 24 May 2000 11:05:19 -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: <959191519-v9-i3147@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 24 May 2000     Volume: 9 Number: 3147

Today's topics:
    Re: &#037; translating ascii to unicode? <flavell@mail.cern.ch>
        [LWP] Requesting from the clients' IP, not the server's <charles.henry@engineer2k.com>
    Re: Accounting Systems Written In Perl??? <rootbeer@redcat.com>
    Re: alias mail and script perl <gellyfish@gellyfish.com>
    Re: Array Question (Peter Lowe)
    Re: Array Question (Jerome O'Neil)
    Re: bug with 5.004_04? <rootbeer@redcat.com>
        Can't Knit Two Files Together <e.roselli@volusoft.com>
    Re: Compile problems - perl5.6.0, AIX 4.3.3.0, gcc 2.95 <rootbeer@redcat.com>
    Re: Converting special chars... <bert@scanlaser.nl>
    Re: Copy A File? <blah@nospam.com>
    Re: Copy A File? (Peter J. Acklam)
    Re: Copy A File? <juex@deja.com>
    Re: DBI and apostrophes <khera@kciLink.com>
    Re: email poser <rootbeer@redcat.com>
    Re: file locking (Peter J Scott)
    Re: file locking <dan@tuatha.sidhe.org>
    Re: Finding IP addresses+ <rootbeer@redcat.com>
    Re: Finding IP addresses+ (I R A Darth Aggie)
    Re: forking <rootbeer@redcat.com>
        hashes vs associative arrays (was: Re: Array Question) (Peter Lowe)
        Help needed with SNPP!!!!!!!!!!!!!! <mkhan@crosscom.com>
    Re: How to read a float type data? <rootbeer@redcat.com>
    Re: How to split this ? <billy@arnis-bsl.com>
    Re: How to split this ? <lr@hpl.hp.com>
    Re: ht auth admin-type scripts <rootbeer@redcat.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 24 May 2000 19:20:37 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: &#037; translating ascii to unicode?
Message-Id: <Pine.GHP.4.21.0005241842000.8380-100000@hpplus01.cern.ch>

On Wed, 24 May 2000, Nadja Herkova wrote:

> so, a CGI form posted from a machine running Windows would allow the user
> to send MS extended characters to the script ? including those blasted
> clever quotes.. 

Sure would.  If people type-in such characters (by keyboard methods or
the plain old ALT/0nnn trick), typical browsers (and here MSIE is no
exception) will merrily send those octets, coded in their %nn form, as
part of the query string:

QUERY_STRING = area=%80%9B%8B%99%0D%0A

as anyone can easily verify (the form itself was explicitly in
iso-8859-1 coding, in case anyone thought that would help).  This is
in spite of what the HTML spec says:

 Note. The "get" method restricts form data set values to ASCII
 characters.

This is odd, because later on it says:

 The content type "application/x-www-form-urlencoded" is inefficient
 for sending large quantities of binary data or text containing
 non-ASCII characters.

so the spec doesn't quite seem to have made up its mind.  Anyhow, one
thing is missing from a submitted form in this submission encoding,
and that's any statement of the character coding in use.

So (taking Netscape as an example) I could submit my latin-1 form
with the character ALT/0241 (n-tilde) and the script gets:

QUERY_STRING = area=%F1%0D%0A

Or I could use View->Characterset to set iso-8859-7 (ISO Greek) and
type-in ALT/0241.  I see a lower-case "rho", of course.  I submit
that, and the script gets exactly the same input as before.

> i feel another revision of my code coming on :-|

The handling of user-supplied data is a ticklish business: you
sure have to be ready for all possibilities, because if you aren't,
there's somebody out there who will call you on it.
 
It's one of the first lessons one needs to learn when handling 
user input (keyword: Tainted data  ;-)

I hope that brought us just about close enough on-topic that the Perl
regulars don't blow the whistle and send us off. This _should_ by
rights be on c.i.w.a.cgi by now, I know.

Anyhow.  For reference, start here and work around: 
http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4

I'm going to set f'ups as a precaution.



------------------------------

Date: Wed, 24 May 2000 18:08:51 +0200
From: "Charles Henry" <charles.henry@engineer2k.com>
Subject: [LWP] Requesting from the clients' IP, not the server's
Message-Id: <8ggur4$4lj$1@news2.isdnet.net>

There is a script "geturl.pl" that is located on my server. It just does an
HTTP request. But the problem is that whenever it is accessed, remotely or
not, it ALWAYS uses the SERVER's IP, not the CLIENT's. I am not trying to
spoof, I just want the script to use the client's IP when making requests,
like it is possible with a ' print "Location: http://www.url.com\n\n" ' (but
the latter structure doesn't allow as much liberty as with LWP) . I hope
this is possible ... any help would be greatly, greatly, appreciated (wasted
too many hours trying to solve this problem).

#-- geturl.pl

print "Content-type: text/html\n\n";
$ua = new LWP::UserAgent;
$ua->agent('Mozilla/4.6 [en] (WinNT; I)');
$ua->request( GET 'http://www.url.com' );
print $ua->content;

#-- Here the script doesn't forward the IP of the person who accesses the
script, but rather the Server's IP

--
Charles Henry




------------------------------

Date: Wed, 24 May 2000 08:37:14 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Accounting Systems Written In Perl???
Message-Id: <Pine.GSO.4.10.10005240830440.23375-100000@user2.teleport.com>

On Wed, 24 May 2000 otrcomm**NO_SPAM**@wildapache.net wrote:

> I realize now that this is probably not the correct forum to pose this
> question too, but I figured that people who work in Perl are generally
> well up on what is available wrt Perl apps.

And folks in alt.pizza.delivery-drivers are generally knowledgeable about
how stop-and-go traffic affects the need for frequent oil changes, but
maybe a newsgroup about automobiles would be a better choice for
discussing that. 

It helps all of us to keep newsgroups on-topic. But even if that weren't
important, you'll probably get better results in your search by other
means than by asking here. None of us knows what software is available any
better than an archive knows. :-)

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Wed, 24 May 2000 15:31:39 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: alias mail and script perl
Message-Id: <vBSW4.852$6T1.139095@news.dircon.co.uk>

[ dejeopardised ]

On Wed, 24 May 2000 14:19:13 GMT, ghorghor@my-deja.com Wrote:
> In article <%FNW4.804$6T1.133153@news.dircon.co.uk>,
>   Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>> On Wed, 24 May 2000 08:11:31 GMT, ghorghor@my-deja.com Wrote:
>> > hello
>> >
>> > i m working on an unix system.
>> >
>> > I ve created an alias in the file aliases like this :
>> >
>> > test_mailing : "|/usr/local/.../script.pl"
>> >
>> > the script should recieve the mail through stdin but it doesn t work
>> >
>>
>> In what way doesnt it work ?  Any number of things could be wrong and
>> only a few of them might have anything to do with Perl.
>>
> 
> i send a mail from an other computer on Windows
> 
> i recieve an mail error like this :
> 
> The following addresses had permanent fatal errors -----
> "|/usr/local/.../Mliste.pl"
> (expanded from: <test_mailing@jeuxvideo.com>) ----- Transcript of
> session follows -----sh: /usr/local/.../Mliste.pl: not found554
> 
> "|/usr/local/.../Mliste.pl"... unknown mailer error 1
> 
> 
> the script is chmod 777 and is in the right directory
> 

Then you might have an error in your program - what happens when you
run the program from the command line.

/J\


------------------------------

Date: Wed, 24 May 2000 16:58:37 GMT
From: pgl@random.noc.clara.net (Peter Lowe)
Subject: Re: Array Question
Message-Id: <slrn8io2ja.a7.pgl@random.noc.clara.net>

In article <slrn8ib5u3.vii.abigail@ucan.foad.org>, Abigail wrote:
>Yeah, a few. The first idea that comes in mind is that you should read
>the documentation.

that was helpful.

-- 
This is not the signature you are looking for. Move along now.


------------------------------

Date: Wed, 24 May 2000 17:08:16 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Array Question
Message-Id: <40UW4.6438$QB4.476558@news.uswest.net>

amerar@unsu.com (Arthur Merar) elucidates:
> 
> Hello,
> 
> I am been playing with multidimentional associative arrays.  I am
> getting the hang of it, but cannot figure out one thing:  How the heck
> do you add rows to the array?  For example, if I have this array:
> 
> %pers_record=('Bogdan'=>{'Address'=>'C1605','Phone'=>'x7869','College'=>'BMC'})
> 
> Now, I want to add another row, with another persons name, how do I do
> it?  I cannot seem to find a way without destroying the original
> element..........

On initialization, just add a comma:

%pers_record=(
   'Bogdan'=>{'Address'=>'C1605','Phone'=>'x7869','College'=>'BMC'},
   'Jones' =>{'Address'=>'12345','Phone'=>'x8367','College'=>'GRCC'}
   );

Its worth noting that if you use fat commas (=>) the single
quotes arround your keys is redundant.

%foo = ( unquoted_key => 'quoted_value');

So you can reduce your handicap by several strokes.

If you want to add a record to an existing hash, you would
do it the same way you normaly would.

$pers_record{'Jones'} = {Address => '12345', Phone => 'x8367'};

HTH!


------------------------------

Date: Wed, 24 May 2000 08:43:35 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: bug with 5.004_04?
Message-Id: <Pine.GSO.4.10.10005240842360.23375-100000@user2.teleport.com>

On Wed, 24 May 2000, Jim Thomason wrote:

> Obviously, it appears to be a problem with 5.004_04, but I tend to
> like more detailed answers than that, so is anyone able to give me a
> more detailed idea about what's happening here?

It's a bug which got fixed sometime after 5.004_04. Are you asking for
more of an explanation than this? I suppose you could dig through the
patch logs to find this one - that's left as an exercise. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Wed, 24 May 2000 18:56:40 +0300
From: "Elisa Roselli" <e.roselli@volusoft.com>
Subject: Can't Knit Two Files Together
Message-Id: <8gh1jr$rdb$1@wanadoo.fr>

Hello,

I'm having some trouble getting output from two separate files and braiding
them together into a single file.

I have a file called a_traduire.exp that consists of nine fields, separated
with a pipe character (|). From this, I wish to recover all fields except
the second and the fourth. The second field is the same for all records. It
consists of the hard-coded string "fr", which I would like to be able to
change to something else, say "en".

The substitution of the fourth field is more complicated. It contains a
column of French-language strings which I wish to substitute with equivalent
strings from another file, extractEng.txt, in a different language (English
for the moment). So, concretely, this is what three records from
a_traduire.exp look like:
***
01ABS02|fr|80|Code client inexistant.||||||
01ABS03|fr|80|Devis client inexistant.||||||
01ABS04|fr|80|Client correspondant à la racine inexistant.|3|C||||
***
And I want that to look like:
***
01ABS02|en|80|Customer Code does not exist.||||||
01ABS03|en|80|Customer Estimate does not exist.||||||
01ABS04|en|80|Customer corresponding to root does not exist.|3|C||||
***

Currently, the program I have developed for this isn't working.
Specifically, the problem I'm having is in imbricating two loops.  Here it
is:
***
#!/usr/bin/perl -w

#Global variables to capture the language code and find the current
directory
$langVar = <STDIN>;
chomp $langVar;
$curDir = `pwd`;
chomp $curDir;

# I open a filehandle for the English text, for the French table with nine
fields, and for an output file.
open(ENGFILE, "<$curDir/extractEng.txt"|| die "Je ne peux pas ouvrir: $!");
open(SAMFILE,"<$curDir/a_traduire.exp"|| die "Je ne peux pas ouvrir: $!");
open(OUT, ">$curDir/traduit2.txt"|| die "Je ne peux pas ouvrir: $!");

# Here's where trouble arises. If I imbrecate the reading of ENGFILE inside
SAMFILE,
# I only get the first record of SAMFILE.
while (<SAMFILE>){
 @sam = split (/\|/);
   foreach $i (<ENGFILE>)

     chomp $i;
     print OUT $sam[0]."|$langVar
|".$sam[2]."|$i|".$sam[4]."|".$sam[5]."|".$sam[6]."|".$sam[7]."|".$sam[8]."|
"."\n";
   }
}

# In an earlier version, I tried the reverse. I read ENGFILE into an array
which I tried to access from
# within SAMFILE, but I only ever got the first value of the array.

close(ENGFILE); etc ...

***

This must be baby stuff, but I've been going round in circles all evening.
Can some kind person point me the way out ?

Many thanks,

Elisa Francesca Roselli




------------------------------

Date: Wed, 24 May 2000 10:56:53 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Compile problems - perl5.6.0, AIX 4.3.3.0, gcc 2.95.2. Help.
Message-Id: <Pine.GSO.4.10.10005241052220.14618-100000@user2.teleport.com>

On Wed, 24 May 2000, Amit Bhati wrote:

> perlio.c:534: conflicting types for `vprintf'

Could you perhaps have the wrong setting for HAS_VPRINTF? If AIX supports
that function (and it looks as if it might), that should, of course, be
defined in your config.h file. If Configure gets this wrong, you may need
to patch hints/aix.sh.

> I know, it would help to have the IBM C Compiler instead, but I cant
> afford that luxury right now.

gcc should be adequate, unless there's some shortcoming in AIX that I
don't know about. Of course, the shortcomings I don't know about in most
systems would fill a big book. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Wed, 24 May 2000 18:14:56 +0200
From: Bert IJff <bert@scanlaser.nl>
Subject: Re: Converting special chars...
Message-Id: <392C0000.DA5A2E2C@scanlaser.nl>



"Alan J. Flavell" wrote:
> 
> On Wed, 24 May 2000, Bert IJff quoted the entire posting including
> sig, always a warning sign:
Sorry about that.
> 
> > "David A. Pegram" wrote:
> 
> > > For example, I'd like to convert "ö" to "o".
> 
> > It greatly depends on the underlying character set (i.e. where does
> > your inout text come from)
> 
> The hon. Usenaut's original posting contained this header:
> 
> Content-Type: text/plain; charset=iso-8859-1
> 
> So the character in question was unambiguously o-umlaut.

Well, I didn't argue about that. 

> ---SNIP --- <

> 
> Copy/pasting into other applications is a local issue, and either
> works or doesn't work.  If it creates meaningless garbage, then it
> isn't useful.

OP said nothing about the local application. So a warning with respect
to the underlying characterset of the source text to be converted is
appropriate IMO.


> 
> This is a difficult enough topic even without the addition of FUD.
> 
> all the best

Same to you


------------------------------

Date: Wed, 24 May 2000 18:02:08 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Copy A File?
Message-Id: <392BFD00.4603B798@nospam.com>

NoSpam,

NoSpam wrote:
> Does this allow variables? e.g. 
> system 'cp $sourcefile $destfile';

  Not with single quotes:  Use double quotes instead.


	Best regards,
		Marco


------------------------------

Date: 24 May 2000 18:33:00 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Copy A File?
Message-Id: <wk4s7naoxv.fsf@math.uio.no>

NoSpam <nospam@nospam.com>:

> system 'cp $sourcefile $destfile';

tjla@guvfybir.qlaqaf.bet (Gwyn Judd) writes:
 
> no you'll need double quotes for that. Oh and you should always check
> the return value:
> 
> system "cp $sourcefile $destfile" || die "could not copy: $!";

Hmm...according to my memory, system() returns 0 upon success, so it
should rather be something along the lines of

   system("cp $sourcefile $destfile") == 0 or die "...";

Peter

-- 
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];


------------------------------

Date: Wed, 24 May 2000 08:26:55 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Copy A File?
Message-Id: <392bf4bf$1@news.microsoft.com>

"Moltimer" <moltimer@yahoo.com> wrote in message
news:8gg5tf$eid$1@news2.kornet.net...
>
>
> NoSpam ÀÌ(°¡) ¸Þ½ÃÁö¿¡¼­ ÀÛ¼ºÇÏ¿´½À´Ï´Ù...
> >What is the Perl command to copy a file from a folder to another?
> This will works.
> `cp aaa/file.txt bbb/file.txt`;

Where do you find a "cp" on a MacIntosh?

jue




------------------------------

Date: 24 May 2000 12:10:22 -0400
From: Vivek Khera <khera@kciLink.com>
Subject: Re: DBI and apostrophes
Message-Id: <x7em6sj5e9.fsf@onceler.kcilink.com>

>>>>> "DC" == Dave Cross <dave@dave.org.uk> writes:

DC> On Mon, 22 May 2000 12:03:20 +0100, "Nick Liebmann" <Nick@ucecom.com>
DC> wrote:

>> I have done a bodge fix on the a mysql call using the DBI module
>> 
>> if($artistname =~ /\'/){$artistname =~ s/\'/\\'/;}
>> 
>>  [ ... ]
>> There must be a better way of doing this....any ideas?

DC> From the DBI docs:

DC> quote

DC>        $sql = $dbh->quote($value);
DC>        $sql = $dbh->quote($value, $data_type);


Even better is to use placeholders in your query's prepare statement,
then call the execute with the values as is and let DBI do the work
for you:

my $sth = $dbh->prepare("INSERT INTO foo (name) VALUES (?)") or die;
$sth->execute($name);

No matter what's in $name, it will work as long as your DBD driver is
not busted.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-545-6996
GPG & MIME spoken here            http://www.khera.org/~vivek/


------------------------------

Date: Wed, 24 May 2000 09:52:11 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: email poser
Message-Id: <Pine.GSO.4.10.10005240948310.23375-100000@user2.teleport.com>

On Wed, 24 May 2000, David Fleet wrote:

> Anyone know why only 300 or so emails get through when I do a mass
> email to myself?

> Is there some sort of default within the email server?

Maybe - but why ask us? We're not your mail admin! :-)

If you're doing everything right and your sendmail (or whatever) isn't
cooperating, then it's broken. But in that case, you should search for the
docs, FAQs, and newsgroups about sendmail, right?

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




------------------------------

Date: Wed, 24 May 2000 17:00:09 GMT
From: peter@PSDT.com (Peter J Scott)
Subject: Re: file locking
Message-Id: <tUTW4.38661$q_4.1024417@news1.gvcl1.bc.home.com>

In article <MPG.1394588314be6e1598aabb@nntp.hpl.hp.com>,
 Larry Rosler <lr@hpl.hp.com> writes:
>$| = 1;
>
>'Short' (< 8K?) prints to append.
>
>No buffering.
>
>No locking.
>
>No problem.

If it *was* buffered ($| = 0), would wrapping the single print in an open..close
be equally reliable?  Because your "short" qualification implies that you rely
upon a buffer not overflowing, and that buffer will be flushed on close().

It appears that your (and my) understanding of I/O is that the write buffer on append 
starts filling up from the point the user starts writing, whereas Dan's is that it 
will already contain the end of the file modulo BUFSIZ.  Stevens appears to be silent
on the issue.  Perhaps it is O/S dependent?  I really don't want to plow through
source to try to figure this one out.  Dan's right, no amount of testing that doesn't 
cause scrambling proves anything.

-- 
Peter Scott


------------------------------

Date: Wed, 24 May 2000 17:20:20 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: file locking
Message-Id: <obUW4.91210$hT2.384022@news1.rdc1.ct.home.com>

Peter J Scott <peter@psdt.com> wrote:
> If it *was* buffered ($| = 0), would wrapping the single print in an open..close
> be equally reliable?  Because your "short" qualification implies that you rely
> upon a buffer not overflowing, and that buffer will be flushed on close().

No.

> It appears that your (and my) understanding of I/O is that the write
> buffer on append starts filling up from the point the user starts
> writing, whereas Dan's is that it will already contain the end of the
> file modulo BUFSIZ.

Actually mine is that you can't count on who's doing the buffering, or
which piece of the puzzle (OS, device drivers, C library) is handling the
buffering and at what level. At some point, with disks at least,
everything breaks down to blocks or clusters. Which bit handles that
depends on your OS, which version of the OS, your C libraries, and
sometimes the phase of the moon.

Yes, I have been bitten by this. I'll repeat the mantra:If you want data
integrity, lock your files. It doesn't really matter (well, outside of
intellectual curiosity) *why* you get no guaranteed atomicity. You don't,
so if you need it you need to do locking.

I play on SMP machines and have for ages, so I'm a bit more aware of the
places this will bite you hard. (Been there, done that, have the teeth
marks)

> Stevens appears to be silent on the issue.  
> Perhaps it is O/S dependent?  I really don't want to plow through source
> to try to figure this one out.  Dan's right, no amount of testing that
> doesn't cause scrambling proves anything.

Trust your man pages. If they don't say "This operation is atomic" then it
isn't. Perl, you'll note, guarantees atomicity exactly *nowhere*. If you
want safe writes (and reads, for that matter), lock.

						Dan


------------------------------

Date: Wed, 24 May 2000 09:08:09 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Finding IP addresses+
Message-Id: <Pine.GSO.4.10.10005240846240.23375-100000@user2.teleport.com>

On Wed, 24 May 2000, Sweth Chandramouli wrote:

> 	Here's the version I whacked together a while ago
> to match in perl; I'm fairly certain that it matches all of the cases
> and no invalid cases:
> 
>    chomp ($_[0]);
>    my $dq_regex = "([01]?[0-9][0-9]?|2([0-4][0-9]|5[0-5]))";
>    ($_[0] =~ m/^(${dq_regex}\.){3}${dq_regex}$/);

Does it match 2130706433? I can telnet to that address; can you? :-)

I can generally find something interesting at this URL, although some
browsers don't work properly with it.

    http://3427256387/

> 	I've actually got a fairly robust set of perl functions
> for matching/parsing IPv4 addresses and netmasks in a variety of formats,
> that I was thinking of posting to CPAN; does anyone know if something like
> that already exists?

Does Net::DNS do what you want? Although maybe all you need is part of
this long line:

    perl -MSocket -lwe 'print +(gethostbyaddr inet_aton(3427256387), AF_INET)[0]'

When something has been needed by a programmer during (more-or-less) every
week since perl came into existence, there's a good chance that it's been
done already. :-)  Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 24 May 2000 16:56:58 GMT
From: sy_nttvr@gurcragntba.pbz (I R A Darth Aggie)
Subject: Re: Finding IP addresses+
Message-Id: <slrn8io2eq.b9i.sy_nttvr@gurcragntba.pbz>

On Wed, 24 May 2000 09:08:09 -0700,
Tom Phoenix <rootbeer@redcat.com>, in
<Pine.GSO.4.10.10005240846240.23375-100000@user2.teleport.com> wrote:
+ On Wed, 24 May 2000, Sweth Chandramouli wrote:
+ 
+ > 	Here's the version I whacked together a while ago
+ > to match in perl; I'm fairly certain that it matches all of the cases
+ > and no invalid cases:
+ > 
+ >    chomp ($_[0]);
+ >    my $dq_regex = "([01]?[0-9][0-9]?|2([0-4][0-9]|5[0-5]))";
+ >    ($_[0] =~ m/^(${dq_regex}\.){3}${dq_regex}$/);
+ 
+ Does it match 2130706433? I can telnet to that address; can you? :-)

localhost?

+ I can generally find something interesting at this URL, although some
+ browsers don't work properly with it.
+ 
+     http://3427256387/

Yahoo!

There's nothing that sez IP #'s have to be quad.dotted in the 0-255 range.

James
-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>


------------------------------

Date: Wed, 24 May 2000 09:45:15 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: forking
Message-Id: <Pine.GSO.4.10.10005240944180.23375-100000@user2.teleport.com>

On Wed, 24 May 2000 bhelton@my-deja.com wrote:

> Subject: forking

> Any pointers would be more than appreciated.

Well, have you read the perlfunc's docs on fork in Perl, and your system's
manpages about fork(2)? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Wed, 24 May 2000 16:57:42 GMT
From: pgl@random.noc.clara.net (Peter Lowe)
Subject: hashes vs associative arrays (was: Re: Array Question)
Message-Id: <slrn8io2hj.a7.pgl@random.noc.clara.net>

In article <Pine.GSO.4.10.10005181526460.25459-100000@user2.teleport.com>,
Tom Phoenix wrote:
>Besides, if you don't use the right name, you'll never be able to find the
>answers in the documentation.

Not meaning to be picky myself, but in the Learning Perl book I've
got here (2nd Edition, dated July 1997) if you look in the index
under "hashes" it says "(see associative arrays)". I personally
think that the phrase associative arrays is a much better word to
use when learning perl, as it actually tells what you're dealing
with if you know what an array is, whereas "hash" doesn't really
tell me much.

-- 
This is not the signature you are looking for. Move along now.


------------------------------

Date: Wed, 24 May 2000 11:13:50 -0500
From: "Mohammad Khan" <mkhan@crosscom.com>
Subject: Help needed with SNPP!!!!!!!!!!!!!!
Message-Id: <392bff4f$0$18620@wodc7nh1.news.uu.net>

Hi,
      Is there any way to send multi choice responses through Perl SNPP
module. For example, I want to send a message to my 2 way skytel pager with
multiple choices response, so that skytel user will choose one of the
responses and email it back to me.

Thanks.




------------------------------

Date: Wed, 24 May 2000 09:27:07 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to read a float type data?
Message-Id: <Pine.GSO.4.10.10005240925040.23375-100000@user2.teleport.com>

On Tue, 23 May 2000, Jian Lin wrote:

> For example, a text file contains three data: 129  3.44 7.5
> I want to read the third data(7.5)
> Is it possible to convert the ASCII code(7.5) into a float type variable ?

Perl doesn't normally offer a float type variable. 

To do what you want depends upon the file format, but it should be trivial
to implement for someone who has read an introductory book on Perl. You
should probably get such a book. Many folks around here recommend
O'Reilly's Llama book, Learning Perl. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: Wed, 24 May 2000 16:12:48 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: How to split this ?
Message-Id: <8ggv1f$h50$1@nnrp1.deja.com>

In article <8ggk54$1ht$1@news2.kornet.net>,
  "Moltimer" <moltimer@yahoo.com> wrote:
> It woks good.

 ... code skipped ...

> However, I couldn't understand this.
> $str =~ /^([^_]+?)_(.+)_([^_]+?)$/
>
> Where can I learn like that ?
>

perldoc perlre (or http://www.cpan.org/doc/manual/html/pod/perlre.html)

perldoc perlop (or http://www.cpan.org/doc/manual/html/pod/perlop.html)
(section "Regexp Quote-Like Operators")

perldoc perlfaq6 (or http://www.cpan.org/doc/manual/html/pod/perlfaq6.html)

And maybe you should get a good book. See perldoc perlfaq2
(orhttp://www.cpan.org/doc/manual/html/pod/perlfaq2.html) for list of books.

> If you give me one more example
> for getting two values of lets[0] and lets[1] with
> "A-1_A-2_A-3_much_more_B",
> I will be happy to learn this.
>
>  $lets[0] should be "A-1_A-2_A-3_much_more"
>  $lets[1] should be "B"
>

#!/usr/bin/perl -w

use strict;

my $str = 'A-1_A-2_A-3_much_more_B';

my @lets = $str =~ /(.+)_([^_]+?)$/;

die "string $str doesn't match\n"  unless @lets;

# that's all

Hope this helps.
Ilja.







Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 24 May 2000 10:21:27 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to split this ?
Message-Id: <MPG.1395af74ffd9583998aac9@nntp.hpl.hp.com>

In article <slrn8iqf18.be8.tjla@thislove.dyndns.org> on Wed, 24 May 2000 
14:41:42 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> says...
> I was shocked! How could Moltimer <moltimer@yahoo.com>
> say such a terrible thing:
> >Thanks llja.
> >It woks good.
> >
> >However, I couldn't understand this.
> >$str =~ /^([^_]+?)_(.+)_([^_]+?)$/
> >
> >Where can I learn like that ?
> 
> That thingy is known as a "regular expression". If you are on a unix
> machine type "perldoc perlre" for an introduction.

That provides an 'introduction' to regexes the same way as being dumped 
in the deep end of a pool provides an 'introduction' to swimming.

This might be a better place to start:

<URL:http://www.netcat.co.uk/rob/perl/win32perltut.html#77-
BasicRegularExpressions>

(Unwind the split at the hyphen, of course.)

The 'win32' in the name of the tutorial is misleading; regexes are 
portable.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Wed, 24 May 2000 10:49:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: ht auth admin-type scripts
Message-Id: <Pine.GSO.4.10.10005241048470.14618-100000@user2.teleport.com>

On Wed, 24 May 2000, Bob Burge wrote:

> Does anyone have pros/cons on using a particular perl
> module for managing authen-type dbm's?

Did you have a particular module in mind? If you're not sure about what a
module can do, check its README (or other docs). If it lacks the docs,
avoid the module. :-)

    http://search.cpan.org/

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

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 3147
**************************************


home help back first fref pref prev next nref lref last post