[11030] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4630 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 12 13:03:16 1999

Date: Tue, 12 Jan 99 10:00:22 -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           Tue, 12 Jan 1999     Volume: 8 Number: 4630

Today's topics:
    Re: A really easy string question (Karlon West)
    Re: Active State package questions (Charles Wilt)
    Re: GD.pm NOT WORKING! <sorcerer@NetVision.net.il>
        Generating a unique number (Daniel)
    Re: grep with boundaries and regex <aqumsieh@matrox.com>
        Headers are stripped off before my script gets the mess mamster@my-dejanews.com
    Re: High resolution timing ! <zenin@bawdycaste.org>
    Re: how to return HTML to a specific frame (Abigail)
    Re: How to stop perldoc scroll on find? (Abigail)
    Re: How to stop perldoc scroll on find? (Matthew Bafford)
    Re: How to stop perldoc scroll on find? <aqumsieh@matrox.com>
        Known incompatibilites between libwww5.20 and Crypt-SSL (Jennifer Ozzello)
        mmap syscall (Doug Smith - Sun BOS Hardware)
    Re: Newbie desperation <debot@xs4all.nl>
    Re: Newbie desperation <aqumsieh@matrox.com>
    Re: Perl Criticism (Bart Lateur)
    Re: Perl Criticism <jeromeo@atrieva.com>
    Re: Perl Criticism <camerond@mail.uca.edu>
    Re: perldoc broke? <upsetter@ziplink.net>
    Re: regexp across multiple arrays, that aren't alike... (Abigail)
    Re: Text manipulation <dropzone@mail.utexas.edu>
    Re: URGENT: Array of arrays... (Randal L. Schwartz)
    Re: Verify an email address (John Moreno)
    Re: Verify an email address <upsetter@ziplink.net>
    Re: Verify an email address <upsetter@ziplink.net>
    Re: Verify an email address (Randal L. Schwartz)
    Re: Verify an email address <upsetter@ziplink.net>
        Web and perl <markopavlisic@iname.dot.com>
        Were to learn PERL Online. <jeffm@shaw.wave.ca>
    Re: Year 2038 problem (John Moreno)
    Re: Yet another REGEX question (John Moreno)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 12 Jan 1999 16:12:16 GMT
From: karlon@bnr.ca (Karlon West)
Subject: Re: A really easy string question
Message-Id: <77fs90$1jj$1@crchh14.us.nortel.com>

info@gadnet.com wrote:
> I'm new to this perl lark and struggling to do the following:

> I have a variable ($variable) which contains:

> $pathname = "/path-of-indeterminate-length/myfile.txt";

> I want to end up with a variable that contains:

> myfile.txt

> I can do it as follows:

> $variable = substr($variable,12);
> chop($variable);
> chop($variable);

> But there has to be a neater way.

> Any ideas?


-------------------------------
#!/usr/bin/perl
use File::Basename;

$pathname="/usr/local/lib/netscape/mime.types";
$variable=basename($pathname);
-------------------------------

Karlon


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

Date: 12 Jan 1999 17:04:34 GMT
From: charles.0272@worldnet.no.spam.att.net (Charles Wilt)
Subject: Re: Active State package questions
Message-Id: <MPG.11054e7c9295d2a79896c1@netnews.worldnet.att.net>

In article <369B6DE3.4EE796AE@us.ibm.com>, ludlow@us.ibm.com says...
> 
> It's not really obvious, but it's in the ActivePerl documentation:
> http://www.activestate.com/activeperl/docs/
> 
> Under "PPM and Firewalls" there's a link to the "ActiveState Repository
> Zipfile archive."  The first time I followed that link, it was like I'd
> found the promised land.
> 

And it even has instructions on how to use it with PPM in an 'offline' 
mode like I need.  Thanks again.  This is definitely something that 
should be a little more prominent in the docs. 

-- 
Charles Wilt
Miami Luken, Inc.
e-mail: charles.0272@worldnet.no.spam.att.net
--->remove the no.spam.


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

Date: Tue, 12 Jan 1999 16:59:37 +0200
From: "Adi G." <sorcerer@NetVision.net.il>
Subject: Re: GD.pm NOT WORKING!
Message-Id: <369B6359.31AEA02D@NetVision.net.il>

Thanks my man,

Good to have people like you on the Net,
you don't have an idea how much you helped me.
The problem I had was that I uninstalled the files and everthing
manually and then ran the ppm, instead of letting it do all the
dirty job..


THANKS THANKS THANKS THANKS... (-:

		
					Adi G.
					ISRAEL.




Chris Hobbs wrote:
> 
> "Adi G." wrote:
> 
> > I tried installing the GD.pm using the PPM, and of course,
> > it was so predictable, it did NOT work... )-:
> 
> Well, I wouldn't call it predictable. FWIW, I just installed it myself,
> and it worked fine:
> 
> C:\Perl\bin>perl ppm.pl
> PPM interactive shell (0.9.4) - type 'help' for available commands.
> PPM> search GD
> Packages available from http://www.ActiveState.com/packages:
>         GD
> PPM> install GD
> Install package 'GD?' (y/N): y
> Installing C:\Perl\site\lib\auto\GD\GD.bs
> Installing C:\Perl\site\lib\auto\GD\GD.dll
> Installing C:\Perl\site\lib\auto\GD\GD.exp
> Installing C:\Perl\site\lib\auto\GD\GD.lib
> Installing C:\Perl\site\lib\auto\libgd\extralibs.ld
> Installing C:\Perl\html\lib\GD.html
> Installing C:\Perl\htmlhelp\pkg-GD.chm
> Installing C:\Perl\htmlhelp\pkg-GD.hhc
> Installing C:\Perl\site\lib\auto\GD\autosplit.ix
> Installing C:\Perl\site\lib\GD.pm
> Installing C:\Perl\site\lib\qd.pl
> Writing C:\Perl\site\lib/auto/GD/.packlist
> PPM>
> 
> > It gave me the Error:
> >
> > ---------
> > E:\Programming\Perl\GD-1.18>ppm
> > .PPM interactive shell (0.9.5) - type 'help' for available commands
> > PPM> install GD
> > Install package 'GD?' (y/N): y
> > Error installing package 'GD': Could not locate a PPD file for
> > package GD
> > -------------
> 
> My apologies if this sounds patronizing, but as I'm very new to Perl,
> and my first attempt at using PPD was today, I was pleasantly surprised
> that it actually goes out to the Internet to download the required
> files. From your command line, it looks like you had downloaded the
> files manually. Were you connected at the time you tried the install?
> 
> Based on what you posted, you've got a little bit newer version of PPM.
> I don't know if there are any problems with this or not, but you might
> try installing the previous version of Perl and see if it will work for
> you. My version is:
> 
> C:\Perl\bin>perl -v
> 
> This is perl, version 5.005_02 built for MSWin32-x86-object
> 
> Copyright 1987-1998, Larry Wall
> 
> Binary build 506 provided by ActiveState Tool Corp.
> http://www.ActiveState.com
> Built 15:40:37 Oct 27 1998
> 
> > What a great language Perl! Pitty I have to spend 8 hours of
> > unproductive work to find out how a module will work.
> 
> I was going to post a witty, sarcastic remark here, but I'll let it
> slide - I'm sure someone else will jump on it.
> 
> > If you can Help me, I promise to even send you money, just
> > help...
> 
> No money required, and I do hope this helps,
> 
> --
> Chris Hobbs chobbs@silvervalley.k12.ca.us|Network Admin   |   Postmaster
> Silver Valley Unified School District    |MCP - TCP/IP    |     J.A.P.H.
> http://www.silvervalley.k12.ca.us/chobbs |A witty saying proves nothing.
>                                                               - Voltaire


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

Date: Tue, 12 Jan 1999 17:25:57 GMT
From: daniel.mendyke@digital.com (Daniel)
Subject: Generating a unique number
Message-Id: <77g0qb$ufg$3@nntpd.lkg.dec.com>


I'm looking for a way to assign truely unigue id numbers
to each visiter to a web site.  I'd like to use charators as well
as numbers and keep the number of digits to eight.

One possible solution might be to use the system
date and time to generator a unique number.

How have others solved this problem?

-Daniel



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

Date: Tue, 12 Jan 1999 12:01:13 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: grep with boundaries and regex
Message-Id: <x3yhftw5sti.fsf@tigre.matrox.com>


pigs_can_fly@mindless.com (Jason Q.) writes:

> 
> Hi,
> 
> From @temp, I need to grep $word, which might be "=F".
> 
> @temp = grep(/\b$word\b/,@temp);
> 
> it fails to identify "=F"
> 
> I suppose it's due to the \b and think I need to specify $word as a
> regex because of the "=".

The reason in the nature of \b. From perlre:

     A word boundary (\b) is defined as a spot between two
     characters that has a \w on one side of it and a \W on the
     other side of it (in either order), counting the imaginary
     characters off the beginning and end of the string as
     matching a \W.

For a string like '=F', the beginning of the string,
just before '=' will be counted as a \W. The equal sign is also a \W
character, so no \b can be matched there. That is why your match
fails. 

> How do I achieve this?

If your string starts with a '=' character, you could do something
like:

@temp = grep /^$word\b/, @temp;

That should do it.

Hope this helps,
Ala



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

Date: Tue, 12 Jan 1999 15:57:10 GMT
From: mamster@my-dejanews.com
Subject: Headers are stripped off before my script gets the message
Message-Id: <77frck$1j9$1@nnrp1.dejanews.com>

Greetings.  I'm writing a Perl sendmail filtering script;  messages sent to a
particular address are forward to the script via an alias.  This works fine,
except that when the message arrives at the script on STDIN, all headers have
been removed and I only have the message body.  I have verified this by simply
substitution:

print FILE <>;

for the actual script, and sure enough, no headers.  Any idea what would make
this happen?  I've browsed the O'Reilly book and found no reason why sendmail
would be dropping headers.  I realize this probably isn't a Perl problem per
se, but I'm crossposting to comp.lang.perl.misc in case I'm misunderstanding
how sendmail passes arguments.

Thanks,
Matthew

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Jan 1999 16:13:57 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: High resolution timing !
Message-Id: <916157632.622456@thrush.omix.com>

[posted & mailed]

Stefan Nonneman <stefan.nonneman@cec.be> wrote:
: I am looking for a high-resolution timer (1ms or finer) that can be used
: in PERL. Recently I found some sites with enormous ammounts of modules etc
: for PERL but I have no idea where to look.
:
: Some suggestion ???

	$ perl -MCPAN -e shell
	cpan> d /Time/
		>snip<
	Fetching with LWP:
	  ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/03modlist.data.gz
	Going to read /usr/home/byron/.cpan/sources/modules/03modlist.data.gz
	Distribution    B/BZ/BZAJAC/DateTime-Precise-0.04.tar.gz
	Distribution    DEWEG/Time-HiRes-01.19.tar.gz
	Distribution    GBARR/TimeDate-1.08.tar.gz
	Distribution    JDUNCAN/Time-Beat-1.00.tar.gz
	Distribution    JPRIT/Time-Virtual-0.03.tar.gz
	Distribution    JPRIT/Time-VirtualAPI-0.04.tar.gz
	Distribution    MUIR/modules/Time-modules-98.112901.tar.gz
	Distribution    P/PE/PETERM/Apache-TimedRedirect-0.12.tar.gz
	Distribution    TOMC/scripts/ADVLABS/timeouts/TimeOut.pm.gz
	Distribution    TOMC/scripts/CS-Talk/source/dstructs/ties/Tie/ClockTimer.pm.gz
	cpan>

	Any of these look interesting?  Maybe Time::HiRes or
	DateTime::Precise?

	`perldoc CPAN' when you get a chance too. :-)

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: 12 Jan 1999 16:02:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: how to return HTML to a specific frame
Message-Id: <77frnj$3h8$3@client3.news.psi.net>

David Campitelli (campitelli@digitalblueworld.com) wrote on MCMLX
September MCMXCIII in <URL:news:77ec48$st8$1@fir.prod.itd.earthlink.net>:
!! 
!! How do I get the script to return the html in the frame that I want.

Your question has nothing to do with Perl. Go away.


Abigail


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

Date: 12 Jan 1999 16:04:22 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to stop perldoc scroll on find?
Message-Id: <77frq6$3h8$4@client3.news.psi.net>

Charles R. Thompson (design@raincloud-studios.com) wrote on MCMLX
September MCMXCIII in <URL:news:77eta1$hle@bgtnsc02.worldnet.att.net>:
() I've noticed when say doing...
() 
() perldoc -f stat
() 
() Some of the text rolls off the screen.


perldoc -f stat | more
perldoc -f stat | page
perldoc -f stat | less
perldoc -f stat > file; vi file



Abigail


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

Date: Tue, 12 Jan 1999 11:23:27 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: How to stop perldoc scroll on find?
Message-Id: <MPG.1105410d30fe70e5989788@news.scescape.net>

In article <77eta1$hle@bgtnsc02.worldnet.att.net>, design@raincloud-
studios.com pounded in the following:
=> I've noticed when say doing...
=> 
=> perldoc -f stat
=> 
=> Some of the text rolls off the screen. Of course I could just go

[snip]

I've found that on Win9x the piping doesn't always work the way it 
should.  When using perldoc, I've found:

perl -e "print `perldoc -f blah`" | more

to work.  It's twisted, but so is Microsoft.

=> CT

HTH!

--Matthew


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

Date: Tue, 12 Jan 1999 12:03:20 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to stop perldoc scroll on find?
Message-Id: <x3yg19g5spz.fsf@tigre.matrox.com>


"Charles R. Thompson" <design@raincloud-studios.com> writes:

> 
> I've noticed when say doing...
> 
> perldoc -f stat
> 
> Some of the text rolls off the screen. Of course I could just go
> 
> perldoc stat
> 
> But I rather like the quick summaries given by -f. Is there
> another switch to make it pause the output 1 screen at a time?
> perldoc perldoc didn't mention anything about it.

Of course, since that's not a Perl issue. I have two suggestions:

1) perldoc -f stat > stat_help

Then you can browse stat_help anyway you like.

2) perldoc -f stat | more

Read more about your OS.

Ala




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

Date: 12 Jan 1999 08:28:23 -0800
From: ozzello@best.com (Jennifer Ozzello)
Subject: Known incompatibilites between libwww5.20 and Crypt-SSLeay0.07?
Message-Id: <77ft77$3sp$1@shell9.ba.best.com>

Hey all,

I'm working on a small client that implements SSL, the test code works on
a friends machine that has libwww5.36, Crypt-SSLeay0.07 and SSLeay0.66b.
On my machine I had to install Crypt and SSLeay locally since the sysop
didn't want it available for general use. The install went fine with
no problems and tests okay. The only difference is that my machine has
libwww5.20, can this be causing the test script to hang? It simply
hangs during execution. I have the same versions of SSLeay and Crypt-SSLeay.

Any help would be appreciated,

Thanks,

Jen


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

Date: 12 Jan 1999 15:45:49 GMT
From: dsmith@Sun.COM (Doug Smith - Sun BOS Hardware)
Subject: mmap syscall
Message-Id: <77fqnd$6j3@walters.East.Sun.COM>

I can map an SBus card into memory on Solaris in C with the following code:

fd = open( devname, O_RDWR, mode);
mmap_reg = mmap(addr_reg, len_reg, prot, flags, fd, off_reg);

Does anyone know how to do the equivalent thing in perl using the syscall
mmap function?  Thanks.

-Doug
------
Doug Smith				Sun Microsystems, Inc.
Computer Engineer			4 Omni Way, MS UCHL04-203
Workgroup Server Hardware		Chelmsford, MA 01824
Phone:  (978) 442-0918			Email:  doug.smith@sun.com
------


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

Date: Tue, 12 Jan 1999 17:05:20 +0100
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: Newbie desperation
Message-Id: <369B72C0.63A3D6D1@xs4all.nl>

Nobody is too stupid for perl. I've tried several computer languages, but
I never learned. But I'm successfull with perl. (I have made a script
almost the same as the Nedstat counter ( http://www.nedstat.net ), but
with more stuff on it like screen width and a full list of referers.
It's more how you gonna " explain " what the scripts must do. The
Commando's are easy. (If you don't know how one commando works, you just
ask it in this newsgroup.

So, don't give up.


Thomas Klinger wrote:

> I'm really desperated!
> I already read "Learning Perl" twice but I can't get into this stuff.
> As help I also bought "Programming Perl" and "The Perl Cookbook" but
> this language is still secret to me.
> I tried to program those examples to understand the syntax but maybe
> I'm to stupid for PERL.
> Maybe I give up.
>
> Kind regards
>
>        Thomas Klinger
>        Systemspecialist
> =======================================
> t.klinger@mobilkom.at
> http://www.mobilkom.at
> =======================================

--
Hi, this piece is put automaticly under every mail from me.

Contact me: debot@xs4all.nl
Visit my page:  http://www.debot.nl/
    http://www.geocities.com/SunsetStrip/Frontrow/4346/top50index.html

I've much more homepage. You can just ask for them if you want.

Well, more I havn't to say, so have a nice day :-)




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

Date: Tue, 12 Jan 1999 12:04:37 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Newbie desperation
Message-Id: <x3yemp05snu.fsf@tigre.matrox.com>


t.klinger@mobilkom.at (Thomas Klinger) writes:

> 
> I'm really desperated!
> I already read "Learning Perl" twice but I can't get into this stuff.
> As help I also bought "Programming Perl" and "The Perl Cookbook" but
> this language is still secret to me.
> I tried to program those examples to understand the syntax but maybe
> I'm to stupid for PERL.
> Maybe I give up.

What's your question?



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

Date: Tue, 12 Jan 1999 16:37:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl Criticism
Message-Id: <369c78c3.30816879@news.skynet.be>

I R A Aggie wrote:

>Even so, there are times when I mutter "what was I thinking? what was I
>DRINKING??"... :)

 ... and do I have any of it left?

 ;-)

	Bart.


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

Date: Tue, 12 Jan 1999 08:20:50 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Perl Criticism
Message-Id: <369B7662.292B3B17@atrieva.com>

topmind@technologist.com wrote:

> > >
> > >@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#
> >
> > Thats not valid perl.
> >
> 
> But I bet it is only a few keystrokes away from being runnable.

I'll take that wager.  If you loose, you go away and never come back.


-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Tue, 12 Jan 1999 11:27:18 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Perl Criticism
Message-Id: <369B85F6.B68B0E1@mail.uca.edu>



I R A Aggie wrote:
> 
> In article <77e7vo$mtk$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
> 
> + That is utterly ridiculous! Why is a working implimentation so
> + important?
> 
> Ummm...'cause I can't try out your strategies and see if they'll work for
> me?
> 
> + It is like saying that only great performers can compose
> + music. Even cartooning is split between the concept
> + people and the actual animators (usually done in Korea).
> 
> Ah, so you're more of a "idea rat", eh?
> 
> James - apologies to Scott Adams...

Love that strip - I've got that particular one up on my wall.

I thought that cartooning was done by computers now. I wonder which
brand does the drawing for Mr. Adams? 

Cameron
camerond@mail.uca.edu


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

Date: Tue, 12 Jan 1999 16:39:02 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: perldoc broke?
Message-Id: <GUKm2.49$N4.4458@news.shore.net>

No, but he may have to dip into capital.

--Art (Sorry, couldn't resist!)

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


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

Date: 12 Jan 1999 16:40:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: regexp across multiple arrays, that aren't alike...
Message-Id: <77fttb$4fm$1@client3.news.psi.net>

Eric Bohlman (ebohlman@netcom.com) wrote on MCMLX September MCMXCIII in
<URL:news:ebohlmanF5FLr4.Jqw@netcom.com>:
@@ Jim Matzdorff <syran@best.com> wrote:
@@ 
@@ : array1: jack,jill,mike,millie,jeff,gordon
@@ : array2: jack is nice, mike is cool, my dog's name is millie, gordon races
@@ 
@@ : The result I want to get would be an array wtih the 1st, 2nd, 4th, and
@@ : 6th values of array2.
@@ 
@@ : Now I *WAS* using:
@@ 
@@ : foreach (@array1)
@@ : {
@@ : 	push (@new, (grep /$_/, @array2));
@@ : }
@@ 
@@ : which worked just fine.  UNTIL i got up to the 500-1000 array values.
@@ : things slowed WAYYYYYYYYY down not to mention has the possiblity of
@@ : running out of memory (which is understandable).  the question
@@ : is, how do i go about speeding things up again.  i am a little bit lost.
@@ 
@@ You're slowing down because the number of comparisons you need to make is 
@@ proportional to the product of the sizes of your two arrays, and that 
@@ product gets big rather quickly.  Fortunately, with the help of hashes, 
@@ you can reduce the number of comparisons to the sum of the two array 
@@ sizes, which is a much more manageable number than their product.  The 
@@ techniques in the arrays section of perlfaq4 are likely to be helpful here.


I don't think so. That works if the elements of array1 and array2 are
to be exact matches. But that isn't in this case. In fact, it isn't
hard to come up with an example where all elements of array1 and array2
are different, yet any element of array1 matches any element of array2.
That would result in an array @new the size of the product of the sizes
of array1 and array2.




Abigail


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

Date: Tue, 12 Jan 1999 11:21:25 -0600
From: Forrest Reynolds <dropzone@mail.utexas.edu>
Subject: Re: Text manipulation
Message-Id: <369B8495.B12AD781@mail.utexas.edu>

icebeerberg@my-dejanews.com wrote:
> 
> I am attempting to parse through a comma delimited text file to take each
while(<>) {
    @comps = split(/\,/,$_);
  }

 what criteria would you like to print the components according to?
  BTW, not sure that comma needs to be escaped

  hth, Forrest
> component and print out the components in a different format based on string
> length. Does anyone have a simple program example that is able to do this,
> or a module which may be able to accomplish this task.
> 
> Any help would be appreciated.
> Spencer
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: 12 Jan 1999 08:49:45 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: URGENT: Array of arrays...
Message-Id: <m17lusbfme.fsf@halfdome.holdit.com>

>>>>> "Brett" == Brett Diamond <Brett.Diamond@lmco.com> writes:

Brett> @{$parent_array[0]} = @row; # the braces around $parent_array[0] are needed

Well, no.  That's dangerous if $parent_array[0] has something like 'fred'
in it already and you don't have soft-refs disabled (you *did* remember
to use strict, right?).  You'll end up setting @fred to @row.

What you want, nearly always, is:

	$parent_array[0] = [@row];

*or* if you can guarantee that you won't later change @row or reuse it:

	$parent_array[0] = \@row;

print "Just another Perl reference hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 12 Jan 1999 11:33:46 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Verify an email address
Message-Id: <1dlil3u.1mf0wav14m3o8eN@roxboro0-019.dyn.interpath.net>

Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:

> John Moreno <phenix@interpath.com> wrote:
> 
> > Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
> > 
> > > That's a rather ethnocentric regular expression, wouldn't you say?
> > 
> > No, it's simply wrong.  There's nothing ethnocentric about that, anybody
> > can be wrong (hell, *I* was wrong once).
> 
> Yes, obviously.  My point was that one of the ways in which it is quite
> wrong is that it only checks for domain names in North America.  [1]
> Hence, ethnocentric.
> 
> 
> [1] and he forgot .us

He probably didn't know about it which leads to my point -- a total lack
of research shouldn't be dismissed as simply "ethnocentric", assuming
that everybody will understand what you mean by "MonicaGate" is
ethnocentric, using (com|net|edu|gov|ca|org) as the tld is simply wrong.

-- 
John Moreno


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

Date: Tue, 12 Jan 1999 16:46:54 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Verify an email address
Message-Id: <20Lm2.51$N4.4458@news.shore.net>


David Formosa (aka ? the Platypus) <dformosa@zeta.org.au> wrote:

:>>works:
:>>/^[\w.-]+\@[\w.-]+\.\w+$/
:>
:>That will accept invalid things like a@x..y .

: And reject valid things like
: postmaster@[127.0.0.1]

In most real-world applications (typically web forms where someone signs
up for a mailing list), I would *want* my email-checker to reject that
address, thank you very much.

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


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

Date: Tue, 12 Jan 1999 16:44:53 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Verify an email address
Message-Id: <9_Km2.50$N4.4458@news.shore.net>


Allan M. Due <due@murray.fordham.edu> wrote:

: Ok, clearly this is a FAQ and folks appropriately direct such individuals to
: perlfaq9, but there is something that has always bugged me about the answer in
: the FAQ.  In many cases a simple regex can do a pretty good job and would work
: well enough for many scripts.  The FAQ even makes the same point.  However,
: the simple regex example in the FAQ doesn't work well.  If you are going to
: give an example, it seems you should give a good example.  But maybe it is
: just me.

Here's what I use (I found it on the net somewhere):

sub CheckEmail {
    my $email = shift @_;

# the next two lines should be one but my newsreader has wrapped them:

    $email =~
/^([\w\-\.\!\%\+]+\@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*\.[a-zA-Z0-9\-]+)$/;

    return (defined $1) ? $1 : '';
}

I'm sure will post immediately with a valid email address that fails this
one, but it works well for me in the real world (i.e., it accepts most
valid addresses and rejects most invalid ones -- in terms of format, not
whether the server exists and accepts mail -- for satisfactory values of
"most").

--Art



-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


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

Date: 12 Jan 1999 09:04:11 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Verify an email address
Message-Id: <m1zp7oa0dw.fsf@halfdome.holdit.com>

>>>>> "Scratchie" == Scratchie  <upsetter@ziplink.net> writes:

Scratchie> Here's what I use (I found it on the net somewhere):

Scratchie> sub CheckEmail {
Scratchie>     my $email = shift @_;

Scratchie> # the next two lines should be one but my newsreader has wrapped them:

Scratchie>     $email =~
Scratchie> /^([\w\-\.\!\%\+]+\@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*\.[a-zA-Z0-9\-]+)$/;

Scratchie>     return (defined $1) ? $1 : '';
Scratchie> }

Scratchie> I'm sure will post immediately with a valid email address
Scratchie> that fails this one, but it works well for me in the real
Scratchie> world (i.e., it accepts most valid addresses and rejects
Scratchie> most invalid ones -- in terms of format, not whether the
Scratchie> server exists and accepts mail -- for satisfactory values
Scratchie> of "most").

And it should only be used as an advisory, allowing the user to OVERRIDE
it if they so choose.

Otherwise, you're rejecting the perfectly valid (and active!) email
address <fred&barney@stonehenge.com> (go ahead, try it!).

Please, people, READ THE FAQ, and don't make stuff up.  Do what the
FAQ says.  Stop engaging in cargo-cult programming and passing on
half-solutions to the naive masses.

<sigh>

print "Just 'nuther Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 12 Jan 1999 17:52:54 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Verify an email address
Message-Id: <WZLm2.58$N4.5659@news.shore.net>

Randal L. Schwartz <merlyn@stonehenge.com> wrote:

: Please, people, READ THE FAQ, and don't make stuff up.  Do what the
: FAQ says.  Stop engaging in cargo-cult programming and passing on
: half-solutions to the naive masses.

You're implying that I haven't read the faq and that I don't understand
what the regex in question does.

The faq says that there is no reliable way of checking an email address
short of sending email to it, and strongly discourages people from making
any attempt to validate email addresses using regexes.  The suggestion
offered ("Include the string "Rumpelstiltskin" in that reply, but spelled
in reverse; that is, start with "Nik...".) is, in my opinion, likely to
weed out more impatient or borderline-interested users than bad email
addresses. If that's the way you want to do it, fine, but most of the
people I work for want to encourage as many people as possible to sign up
on their web sites. 

Here's the problem, though: one of the most common errors I've found in
dealing with email addresses in the real world is that AOL users often
enter their addresses like so:

	art cohen@aol.com

(This is assuming that they even know to put the .com at the end!). The
reason for this is that within AOL, spaces are optional in user names. If
I ask the person to enter his email twice, chances are he'll enter it this
same way twice. No help there. If I send a test email to this address
(using sendmail) I get two emails sent: one to "cohen@aol.com" (which may
exist) and one to "art" at my local mail host, which may exist. In either
case, I wind up sending unsolicited email to a completely unrelated third
(or fourth) party, which may result in complaints.

So, for my purposes, I find it useful to use a regex which (among other
things) does not allow spaces in user names, even though 
"a f &#$% "@someserver.com 
may be a perfectly valid user name. I'm willing to make that sacrifice.
For my purposes, it works better for me to make it easy for people to sign
up, and to take the risk of excluding some email addresses that don't
match the pattern.

Like I said in my original post, using that regex allows MOST
validly-formatted email addresses and excludes MOST invalidly-formatted
ones for values of "MOST" that satisfy my needs.

: <sigh>

Sorry that everyone's business needs don't match yours, but there's not a
lot I can do about that.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
--------------------------------------------------------------------------


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

Date: Tue, 12 Jan 1999 17:03:29 GMT
From: "Mark Jean Do" <markopavlisic@iname.dot.com>
Subject: Web and perl
Message-Id: <BfLm2.297$2u.5302330@news.siol.net>

I can get some html with Perl. But how can I get file if it requires to
logon? I know username and password.

--
--
Marko ma vas rad.
http://members.xoom.com/markjeando/




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

Date: Tue, 12 Jan 1999 17:42:38 GMT
From: "Jeff" <jeffm@shaw.wave.ca>
Subject: Were to learn PERL Online.
Message-Id: <iQLm2.125$W2.148@news.rdc1.on.home.com>

I have had experience programming in C before, and I am trying to get into
the web development area to make some money in my spare time when I don't
have too much homework... Does anyone have a web site that I can learn perl
from, which won't waste too much time explaining concepts which I allready
know from C?  Do you recomend any books?  Please e-mail me back! Thanks for
the help! =)

- Jeff
- jeffm@shaw.wave.ca





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

Date: Tue, 12 Jan 1999 11:43:06 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Year 2038 problem
Message-Id: <1dliofw.s7m5o61hqj864N@roxboro0-019.dyn.interpath.net>

Abigail <abigail@fnx.com> wrote:

> Bart Lateur (bart.lateur@skynet.be) wrote on MCMLIX September MCMXCIII in
> <URL:news:369b3af1.1070543@news.skynet.be>:
> () 
> () Yes, there'll have to be a solution before then. It will most probably
> () involve representing time in 64 bits.
> 
> 
> 30 years wasn't enough going from 2 digit years to 4 digit years.
> What makes you think 40 years will be enough to go from 32 bits to 64?

Because the change is going to be driven by something other than bugs in
someone elses code.

-- 
John Moreno


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

Date: Tue, 12 Jan 1999 11:33:49 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Yet another REGEX question
Message-Id: <1dlil41.1rfjchg5ep3j1N@roxboro0-019.dyn.interpath.net>

K.T. <death@N-O-S-P-A-M.solaris1.mysolution.com> wrote:

(text relocated to where it belongs -- you should adjust your newsreader
so that the prefered quoting method is "internet style quotes".)

> John Moreno wrote in message
> >
> >$_="string1\tstring2\t-305\tstring4";
> >
> >s/([^\t]*?)\t([^\t]*?)\t([+-]*\d*?)\t(.*)/"$1","$2",$3,"$4"/;
> >
> >gives:
> >"string1","string2","-305","string4"
> >
-snip-
> Cool, that works...I don't understand some of the expressions used fully
> tho.
> [] is used for sets [^] means no range...what does [^\t] do?
> also what is the [+-]?  I think that is in case of a sign present? And why
> is that suffixed with the "*" and not "*?"?

[^\t] means not a tab. [^] doesn't mean "no range", it means "not in the
set" (which makes sense when you realize that [] is a set operator not a
range operator).

The [+-] was indeed in case there was a sign present, * means zero or
more, since the ? means to use a non-greedy match, and that's irrelevant
at that point, I didn't use it (and the more strict test would have been
[+-]{0,1} to make sure that there wasn't more than one).

-- 
John Moreno


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

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

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