[16935] in Perl-Users-Digest
Perl-Users Digest, Issue: 4347 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 17 09:05:31 2000
Date: Sun, 17 Sep 2000 06:05:07 -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: <969195907-v9-i4347@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 17 Sep 2000 Volume: 9 Number: 4347
Today's topics:
ANNOUNCE: Term::Sample v0.25 <jdb@wcoil.com>
Re: binmode(): How is OS related with "\n"? <bart.lateur@skynet.be>
Can I do this with perl/cgi ? pularis@my-deja.com
Re: Count of items is EXCEPTION not RULE (was Re: Littl (Mark-Jason Dominus)
Re: Determining the length of a string (Abigail)
Re: How to realize the cookies with perl script. (Tony L. Svanstrom)
Re: Is this terribly inefficient? <wells@cedarnet.org>
Re: Is this terribly inefficient? (Martien Verbruggen)
Re: Is this terribly inefficient? (Martien Verbruggen)
Re: One program w/ many languages (Radovan Garabik)
Perl Debugger <doronn@galileo.co.il>
perldoc and CPAN [was: obfuscator or compiler] <iltzu@sci.invalid>
Re: Qualifications for new Perl programmer????? (Andrew Johnson)
Re: Qualifications for new Perl programmer????? <bart.lateur@skynet.be>
Re: Regular Expression for matching with email addresse <bart.lateur@skynet.be>
Variable Substitution <wells@cedarnet.org>
Variable Substitution <wells@cedarnet.org>
Re: Variable Substitution (Gwyn Judd)
Re: what is the best way to get the lastest line from a (Mark-Jason Dominus)
Re: which the best scripting language? <tyson@ona.gov.au>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Sep 2000 03:22:46 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: ANNOUNCE: Term::Sample v0.25
Message-Id: <ss91hi3aopcne8@corp.supernews.com>
Greetings Perlfolk,
Announcing the release of:
Term::Sample 0.25
Recomended Download URL:
http://www.josiah.countystart.com/modules/get.pl?term-sample:announce
It has also has entered CPAN as
file: $CPAN/authors/id/J/JB/JBRYAN/Term-Sample-0.25.zip
size: 25710 bytes
md5: 4022b45eb91e4c8a0cd468f6f987aef1
** What is this?
Term::Sample (version 0.25) - Finger printing of your keyboard typing
** Huh?
Term::Sample implements simple typing analysis to find the "personality"
in your typing. It uses Time::HiRes and Win32::Console for best results.
If it is not run on a Win32 system, it defaults to Term::ReadKey instead
of Win32::Console. I'm not sure how well it works with ReadKey, as I have
not had a chance to test it out yet.
In this module we deal with three basic items: samples, analysis', and
sets. Samples are what you get from the sample() function and are raw
keyboard data. Samples can be averaged together to produce master
samples, or analyzed to produce unique sample analysis'. Analysis' are
produced by alanlyze()-ing samples from sample() or samples averaged
together(). You can store samples (averaged or analyzed) and analysis'
in sets according to unique, user-defined keys. You can then match new
samples against the samples in the set and find out which key it matched
in the set, as well as the percentage of error.
This module uses Time::HiRes to time both the key-press time (time
between the key-down signal and the key-up signal) and the key-interveal
(time between key-up of previous key and key-down of next key). This
creates what I call a keyboard sample, or just a "sample." This is created
by a custom prompt function, sample() which returns an array ref. This is
the raw keyboard sample data. It can be averaged together with multiple
sample to create a master sample to be used as a signiture, or it can be
individually saved with save().
You can create a unique 'print', or analysis from a sample, or samples
averaged together with analyze(). analyze() uses several factors to
make the unique analysis. First, it calculates average ASCII key codes,
as well as the average total key-press and inter-key times. Then it loops
through the sample and picks out the fastest key-press times and inter-key
times, and taking a three-key average around that high-point to create a
sample highlight. It creats highlights from every key in the sample,
fastest to slowest, and then sorts the hightlights by key-press times
and inter-key times, storing both lists in a final "analysis" object, along
with the averaged times created at the start. This gives a final,
hopefully unique, sample analysis.
Four examples and the synopsis is included. Enjoy, and PLEASE let me
know how it works for all of you that use it. Thankyou!
As always, included is a cleaned, CSS-ed, HTML-format of the POD docs.
Regards,
--
Josiah Bryan
jdb@wcoil.com
Tel: 937.316.6256
------------------------------
Date: Sun, 17 Sep 2000 10:00:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: binmode(): How is OS related with "\n"?
Message-Id: <1e59sso0nni15d36jhtm03bjgi4sc9jbc5@4ax.com>
Tim Hammerquist wrote:
>> No, you forget about the side effect on PC.
>
>How am I wrong in this? I said "*nix won't care one way or another."
>Since when did PC (which I interpreted as DOS/Windoze) come under *nix?
If you don't care about anything but *nix, you might just as well forget
about binmode(). It helps in writing cross-platform code, in particular:
code also targetted to PC. AFAIK binmode() is a noop on every other
platform. (I don't know about VMS.)
--
Bart.
------------------------------
Date: Sun, 17 Sep 2000 09:59:37 GMT
From: pularis@my-deja.com
Subject: Can I do this with perl/cgi ?
Message-Id: <8q24m4$30h$1@nnrp1.deja.com>
We have NT 4.0 with IIS with perl installed.I have some Resource kit
utilities that I would like the users to run off the web server and
view the output as an html page. Is this attainable ?. Thx
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 11 Sep 2000 02:59:51 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Count of items is EXCEPTION not RULE (was Re: Little perl annoyance #371: glob)
Message-Id: <8phhr7$oli$1@tikehau.netreach.net>
In article <8pgur9$csnku$10@ID-24002.news.cis.dfn.de>,
Tina Mueller <news@tinita.de> wrote:
>hm, maybe i didn't make this clear enough. i said:
>>> if there is an array returned from a function, then
>>> $n = func();
>>>will give you always the size.
No Perl function ever returns an array, so your statement is only
vacuously true.
"If there is a giant purple water buffalo returned from a function,
then $h = func() will always give you the length of its nose."
------------------------------
Date: 17 Sep 2000 07:46:47 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Determining the length of a string
Message-Id: <slrn8s8tl4.h8o.abigail@alexandra.foad.org>
David H. Adler (dha@panix.com) wrote on MMDLXXIV September MCMXCIII in
<URL:news:slrn8s8nl9.gol.dha@panix6.panix.com>:
&&
&& /(.)\z/s;
&& $length = rindex($_, $1)+1;
This, unfortunally, fails to provide the correct answer on "".
Abigail
--
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
. "\162\1548\110\141\143\153\145\162\0128\177" and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}
------------------------------
Date: Sun, 17 Sep 2000 09:32:36 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: How to realize the cookies with perl script.
Message-Id: <1eh3jql.8o1lg4sl258gN%tony@svanstrom.com>
<i0519@my-deja.com> wrote:
> I am program a CGI with perl in solaris.
> And we want to realize the cookie mechanism in the program.
> Is their any function /example about this?
Not sure what you're trying to say there, old chap; but here's how you
go about creating cookies (don't forget to watch out for evil
linebreaks):
use strict;
sub the_swedish_cookiemaker() {
# (c)2000 svanstrom.com - vers: 2000y-06m-07d 01:10t CET
my($name,$value,$stay,$path,$domain,$sec) = @_;
if (($domain =~ tr/\.//) < 2) {$domain = ".$domain";}
my @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday',
'Saturday');
my @months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct',
'Nov','Dec');
(my @temptime) = gmtime(time+$stay);
my $cookietime = "@days[$temptime[6]], $temptime[3]-@months[$temptime[4]]-".
($temptime[5]+1900) . " "; my @ends = (':',':',' GMT',);
my $i; foreach ($temptime[2],$temptime[1],$temptime[0]) {
$i++;
if ($_ < 10) {$cookietime .= "0$_$ends[$i-1]"
} else {$cookietime .= "$_$ends[$i-1]"
}
}
return("Set-Cookie: $name=$value; expires=$cookietime; path=$path;".
" domain=$domain; $sec\n");
}
print &the_swedish_cookiemaker('namn','value',60*60*24*365,'/','svanstrom.com',0);
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Sun, 17 Sep 2000 15:56:25 +0800
From: Stephen Daniel Wells <wells@cedarnet.org>
Subject: Re: Is this terribly inefficient?
Message-Id: <39C47929.47D92405@cedarnet.org>
Stephan Carydakis wrote:
>
> Hello All,
>
> I have written a sort subroutine which I think maybe a little inefficient.
> Why do I think it's inefficient? Well, $a/$b are entire records from a flat
> file db(1 line per record) and I use re's to extract the dates from the
> record which I then split up into day/month/year using re's again. Is this
> inefficient? Could someone suggest a better way?
>
> My code:
>
> sub byDate {
>
> my ($dateA, $dateB, $yearA, $yearB, $monthA, $monthB, $dayA, $dayB);
>
> $a =~ m/.*?\|.*?\|.*?\|(.*?)\|.*/;
> $dateA=$1;
>
> $b =~ m/.*?\|.*?\|.*?\|(.*?)\|.*/;
> $dateB=$1;
>
> $dateA =~ m|(.*?)/(.*?)/(.*)|;
> ($dayA,$monthA,$yearA)=($1,$2,$3);
>
> $dateB =~ m|(.*?)/(.*?)/(.*)|;
> ($dayB,$monthB,$yearB)=($1,$2,$3);
>
> $yearB <=> $yearA
> ||
> $monthB <=> $monthA
> ||
> $dayB <=> $dayA;
>
> }
what about something like this?
sub byDate {
my (@d) = map split (/\//, [split (/\|/, $a)]->[3]), ($a, $b);
$d[2] <=> $d[5] ||
$d[1] <=> $d[4] ||
$d[0] <=> $d[3];
}
STEVE
------------------------------
Date: Sun, 17 Sep 2000 22:04:20 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is this terribly inefficient?
Message-Id: <slrn8s999k.ntr.mgjv@martien.heliotrope.home>
On Sun, 17 Sep 2000 11:09:53 +1000,
Stephan Carydakis <steph@hotkey.net.au> wrote:
> Hello All,
>
> I have written a sort subroutine which I think maybe a little inefficient.
> Why do I think it's inefficient? Well, $a/$b are entire records from a flat
> file db(1 line per record) and I use re's to extract the dates from the
> record which I then split up into day/month/year using re's again. Is this
> inefficient? Could someone suggest a better way?
One thing you could consider doing is parsing the dates outside of the
sort routine, and storing the stuff you want as arrays. That means that
you only are doing the parsing once per element of your list, while
doing it inside the sort routine means you may be (and probably are)
doing it multiple times per element.
Two techniques that do this and that are often used in Perl are the
Schwartzian Transform and the GRT (Guttman-Rosler Transform). Both are
discussed quite often on this group. The ST can be found in the
documentation (perl FAQ) and
http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html. The GRT is discussed
at http://www.hpl.hp.com/personal/Larry_Rosler/sort/sorting.html
> My code:
>
> sub byDate {
>
> my ($dateA, $dateB, $yearA, $yearB, $monthA, $monthB, $dayA, $dayB);
>
> $a =~ m/.*?\|.*?\|.*?\|(.*?)\|.*/;
> $dateA=$1;
>
> $b =~ m/.*?\|.*?\|.*?\|(.*?)\|.*/;
> $dateB=$1;
>
> $dateA =~ m|(.*?)/(.*?)/(.*)|;
> ($dayA,$monthA,$yearA)=($1,$2,$3);
>
> $dateB =~ m|(.*?)/(.*?)/(.*)|;
> ($dayB,$monthB,$yearB)=($1,$2,$3);
>
> $yearB <=> $yearA
> ||
> $monthB <=> $monthA
> ||
> $dayB <=> $dayA;
>
> }
It would be helpful if, instead of this code, or even better, in
addition to this code, you would have specified the format of your data.
Maybe we could have presented you with a more efficient way of parsing
the date, without regexen, or with more efficient regexen. Now we have
to assume that you are doing this as efficient as possible, and we have
to assume that when deparsing your code, that it is correct. For
example: it would be very useful to know whether empty fields are
allowed (i.e two '|' can follow each other), or maybe no digits ever
appear before the date field, or there are no other slashes or date-like
fields anywhere. it is very possible that you could get away with a RE
as simple as
m#(\d+)/(\d+)/(\d+)#
if there are no other 'dates' preceding the one you want. If the date is
always specified as MM/DD/YYYY that would also be helpful, because it
would allow us to stay away from quantifiers like * and +, and would
allow us to write
m#(\d\d)/(\d\d)/(\d\d\d\d)#
which is faster than the one above again.
Let me just try to deparse what you have there. You have a line with n
fields, with '|' as a delimiter. The date is stored in the format
DD/MM/YY, or D/M/YYYY or something like that in the fourth field (i.e.
after the third '|'). I am making the assumption that 'dates' can appear
in any of the preceding fields, but the character '|' never appears
anywhere except as a delimiter, or after the date.
@sorted =
map { $_->[0] }
sort { $a->[3] <=> $b->[3] ||
$a->[2] <=> $b->[2] ||
$a->[1] <=> $b->[1] }
map { [$_, m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#] }
@unsorted;
I think that RE is as efficient as it gets, and I'm sure I'll be
corrected if not.
For readability, you could use split, and it may even be faster:
@sorted =
map { $_->[0] }
sort { $a->[3] <=> $b->[3] ||
$a->[2] <=> $b->[2] ||
$a->[1] <=> $b->[1] }
map { [$_, split('/', (split /\|/)[3])] }
@unsorted;
Since you are actually comparing dates, it may be beneficial to
translate the whole thing into a unix time, which is a simple integer
that you can compare. Saves you from having to compare more than one a
lot if your dates all fall in the same year and month.
use Time::Local;
@sorted =
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#;
[$_, timelocal(0,0,0,$1,$2-1,$3)] }
@unsorted;
And some of the date parsing modules on CPAN may actually be faster
even, although I doubt that.
Just for completeness, we should present a GRT:
@sorted =
map { substr $_, 3 }
sort
map { pack("C3", reverse m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#).$_ }
@unsorted;
Benchmark:
use strict;
use Time::Local;
use Benchmark;
my @unsorted = <DATA>;
chomp(@unsorted);
my @sorted;
timethese(-5, {
'RE' => sub {
@sorted =
map { $_->[0] }
sort { $a->[3] <=> $b->[3] ||
$a->[2] <=> $b->[2] ||
$a->[1] <=> $b->[1] }
map { [$_, m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#] }
@unsorted;
},
'split' => sub {
@sorted =
map { $_->[0] }
sort { $a->[3] <=> $b->[3] ||
$a->[2] <=> $b->[2] ||
$a->[1] <=> $b->[1] }
map { [$_, split('/', (split /\|/)[3])] }
@unsorted;
},
'RE-timelocal' => sub {
@sorted =
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#;
[$_, timelocal(0,0,0,$1,$2-1,$3)] }
@unsorted;
},
'split-timelocal' => sub {
@sorted =
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { my @a = split '/', (split /\|/)[3];
$a[1]--;
[$_, timelocal(0,0,0,@a)] }
@unsorted;
},
'RE-GRT' => sub {
@sorted =
map { substr $_, 3 }
sort
map { pack("C3", reverse m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#).$_ }
@unsorted;
},
'split-GRT' => sub {
@sorted =
map { substr $_, 3 }
sort
map { pack("C3", reverse split('/', (split /\|/)[3])).$_ }
@unsorted;
},
});
__DATA__
foo|bar|baz|1/2/1999|banana|groupie
argh|bur|boo|2/1/2000|beepie|barba
fargh|bur|boo|13/2/2000|beepie|barba
33|bur|boo|25/1/2000|beepie|barba
gloop|bur|boo|25/12/1999|beepie|barba
For small sets, like the one above:
Benchmark: running RE, RE-GRT, RE-timelocal, split, split-GRT,
split-timelocal, each for at least 5 CPU seconds...
RE: 6 wallclock secs ( 5.07 usr + 0.00 sys = 5.07 CPU) @
5069.43/s (n=25702)
RE-GRT: 6 wallclock secs ( 5.30 usr + 0.00 sys = 5.30 CPU) @
6574.34/s (n=34844)
RE-timelocal: 6 wallclock secs ( 5.24 usr + 0.00 sys = 5.24 CPU) @
1020.04/s (n=5345)
split: 6 wallclock secs ( 5.14 usr + 0.01 sys = 5.15 CPU) @
4891.26/s (n=25190)
split-GRT: 6 wallclock secs ( 5.23 usr + 0.00 sys = 5.23 CPU) @
6662.33/s (n=34844)
split-timelocal: 6 wallclock secs ( 5.34 usr + 0.00 sys = 5.34 CPU) @
1110.49/s (n=5930)
For larger sets (100 elements) with all the rows in the same month of
the same year:
Benchmark: running RE, RE-GRT, RE-timelocal, split, split-GRT,
split-timelocal, each for at least 5 CPU seconds...
RE: 6 wallclock secs ( 5.30 usr + 0.01 sys = 5.31 CPU) @
236.16/s (n=1254)
RE-GRT: 6 wallclock secs ( 5.38 usr + 0.00 sys = 5.38 CPU) @
369.52/s (n=1988)
RE-timelocal: 6 wallclock secs ( 5.32 usr + 0.00 sys = 5.32 CPU) @
50.19/s (n=267)
split: 6 wallclock secs ( 5.30 usr + 0.00 sys = 5.30 CPU) @
213.21/s (n=1130)
split-GRT: 6 wallclock secs ( 5.25 usr + 0.00 sys = 5.25 CPU) @
338.29/s (n=1776)
split-timelocal: 6 wallclock secs ( 5.38 usr + 0.01 sys = 5.39 CPU) @
54.17/s (n=292)
Conclusions:
The RE and the split methods hardly differ in performance. The GRT is
faster than a ST in this case. Transforming the three integers to one,
with timelocal makes the sort perform worse.
Awaiting corrections and speed improvements.
I hope this post gets you on the right track, but keep reading the
thread, Doubtless, people will improve on and correct my post.
Martien
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: Sun, 17 Sep 2000 22:23:52 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is this terribly inefficient?
Message-Id: <slrn8s9ae8.ntr.mgjv@martien.heliotrope.home>
On Sun, 17 Sep 2000 22:04:20 +1100,
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> Just for completeness, we should present a GRT:
>
> @sorted =
> map { substr $_, 3 }
> sort
> map { pack("C3", reverse m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#).$_ }
> @unsorted;
Bzzzt.
Since the year most likely is a four digit number, the pack template
(and the substr index) should be slightly different..
@sorted =
map { substr $_, 4 }
sort
map { pack("C2 S", reverse m#^(?:[^|]*\|){3}(\d+)/(\d+)/(\d+)\|#).$_ }
@unsorted;
This should be fixed for both GRT subs in the benchmark. The
benchmark results are similar, so I won't repost them for the new
situation.
Martien
--
Martien Verbruggen |
Interactive Media Division | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: 17 Sep 2000 12:31:29 GMT
From: garabik@center.fmph.uniba.sk.spam (Radovan Garabik)
Subject: Re: One program w/ many languages
Message-Id: <8q2dj1$rur$1@sunnews.cern.ch>
In alt.folklore.computers Arthur T. Murray <uj797@victoria.tc.ca> wrote:
: fred backman, fred@lateral.net, wrote on Fri, 15 Sep 2000:
:> A couple of years ago I came across a program listing
:> (a hundred lines or so) which could be compiled as many
:> different languages, e.g. pascal, perl, c, etc.
:> (sorry I cannot remember exactly which ones).
:> If I remember correctly, the trick was to use comments
:> and trick the individual compilers into thinking it was
:> a pascal/perl/c program, when in fact it was all of them.
such programs come and go... look at
http://atrey.karlin.mff.cuni.cz/~pavel/podfuk/podfuk.c
which is a regular C program and a Makefile.
: ATM:
: Similar games can be played with words and letters that mean
: one thing in English but other things in foreign languages,
: and vice versa. Can anybody translate (compile in their heads)
: the following snippets of linguistic ambiguity?
: it comes (Latin from Vergil)
: BEC OCMOTP Y HAC (language? meaning?)
russian, words carefully chosen using cyrillic letter that look
a lot like some letters from latin alphabet, escaping the need
to transliterate or to have a russian font
meaning "we have all (the) examination" or something
there should be a soft sign I guess (BECb = all,
BEC = weight and then the sentence does not make sense)
there is nothing inheritedly peculiar in this sentence, though
--
-----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik |
| __..--^^^--..__ garabik @ fmph . uniba . sk |
-----------------------------------------------------------
------------------------------
Date: Sun, 17 Sep 2000 15:58:01 +0200
From: Doron Nisenbaum <doronn@galileo.co.il>
Subject: Perl Debugger
Message-Id: <39C4CDE9.634B11E@galileo.co.il>
Hi,
What tool i can use to debug my perl scripts?
Simple,free,frendly?
Is there a way to use Xemacs?
(I use SunOS , UltraSPARC-IIi-Engine )
Thanks
Doron
------------------------------
Date: 17 Sep 2000 10:24:10 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: perldoc and CPAN [was: obfuscator or compiler]
Message-Id: <969184711.21299@itz.pp.sci.fi>
In article <0fvw5.241841$Gh.5726979@news20.bellglobal.com>, Yanick Champoux wrote:
>
>Hmmm, adding a -g option to perldoc so that it directly access google
>would be evil, right? :)
Maybe. However, making perldoc use CPAN.pm, now there's an idea..
perldoc -c -v Obscure
Searching for Obscure
Looking for Obscure in /usr/lib/perl5/5.005/i386-linux /usr/lib/perl5/5.005 /usr/local/lib/site_perl/i386-linux /usr/local/lib/site_perl /usr/lib/perl5 . /usr/local/bin /usr/bin /bin /usr/bin/X11 /usr/games
Searching for Obscure in CPAN
Downloading modlist.. . . done!
Loosely found as http://www.cpan.org/modules/by-module/Silly/Obscure-0.23.tar.gz
Downloading pod .. . done!
/usr/bin/less: Segmentation fault -- core dumped.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla | "By promoting postconditions to
and its pseudonyms - | preconditions, algorithms become
do not feed the troll. | remarkably simple." -- Abigail
------------------------------
Date: Sun, 17 Sep 2000 08:09:41 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <9%_w5.18267$a5.260437@news1.rdc1.mb.home.com>
In article <8q0tsk$q2k$1@nnrp1.deja.com>,
Brendon Caligari <bcaligari@my-deja.com> wrote:
[snip]
! Given the way I've been flamed here especially by some of the
! grandmasters, I would like to stress out that it wasn't my intention
! to hurt anybody's feelings.
Funny, I didn't see you get flamed at all -- guess I wasn't paying
attention.
! I believe that there is a consensus that while Perl is good, perl
! alone is not sufficient for a comprehensive education in
! programming. It would be pretentious of oneself to call himself or
! practice as a programmer if his exposure has been limited to one
! language.
No more so than anyone calling herself a programmer having only
exposure to any other single language. This is not a language
specific issue -- would you accept me as a programmer if my only
experience was with C? or Hypertalk? or Pascal? or Prograph? or
Fortran? or Basic? or awk? or assembly? or mix? or scheme? or Python,
or ... whatever?
Is any one language sufficient for a comprehensive education in
programming? Wouldn't a comprehensive education in programming
involve more than just learning a single language?
! At the end of the day, a programming language is a tool with which to
! carry out solutions derived from certain theories and practices.
And so any student must start learning such tools -- why do you view
Perl as such a bad tool with which to begin such an education?
regards,
andrew
--
Andrew L. Johnson http://members.home.net/andrew-johnson/
I've always maintained a cordial dislike for indent, because it's
usually right.
-- Larry Wall in <199806221558.IAA07251@wall.org>
------------------------------
Date: Sun, 17 Sep 2000 09:49:10 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <9r49ss02vlnfhs618lvgdgifnr4c7b5kid@4ax.com>
brian d foy wrote:
>In article <8q0tsk$q2k$1@nnrp1.deja.com>, Brendon Caligari wrote:
>> It would be pretentious of oneself to call
>> himself or practice as a programmer if his exposure has been
>> limited to one language.
>
>i don't agree.
Neither do I. So, in the early days when there was nothing but Assembly
and Fortran, there were virtually no programmers?
--
Bart.
------------------------------
Date: Sun, 17 Sep 2000 10:40:42 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regular Expression for matching with email addresses
Message-Id: <ek59ss058igiulmv2l1amqkvkncgk26420@4ax.com>
Albert Dewey wrote:
>Try this - works for me -
>
>if ($Email =~ /[\w\-]+\@[\w\-]+\.[\w\-]+/)
> {
> Do stuff
> }
So you both fail to match my e-mail address (dot in the local part), and
addresses of people living in the UK or Australia (domain names are like
"domain.co.uk").
The FAQ says it is impossible to match every possible email address with
a regex. That is a bit exaggerated. It is impossble, if you allow
comments in the email address, which are meaningmess anyway. Comments
may be nested, which implies a recursive definition.
If you do online email address checks, it is not unreasonable to reject
any address that contains a comment (canonical address: the minimum that
you need to extract from an address), or at least, nested comments.
They're only e-mail address obfuscation, anyway. If, however, you want
to extract email addresses from documents over which you have no control
whatsoever, you do have to properly parse them.
For a validator, check out RFC::RFC822:Address on CPAN
(<http://search.cpan.org>). That package also requires
Parse::RecDescent, also on CPAN. Neither needs compilation, manual
installation is simple (copy the .pm files to their appropriate
location).
If you'd like to tackle email address validation using a regex, check
out the mailbox (addr_spec) grammar in the RFC::RFC822:Address module.
A disadvantage is that it only *checks* an e-mail address, it does not
extract the canonical address. Another module, Mail::Address part of the
MailTools package (also on CPAN), does not only check an address, but
you can extract the canonical addresses from them as well.
--
Bart.
------------------------------
Date: Sun, 17 Sep 2000 14:02:42 +0800
From: Stephen Daniel Wells <wells@cedarnet.org>
Subject: Variable Substitution
Message-Id: <39C45E82.21AEA3EB@cedarnet.org>
I'm sure that Tom, Randal or someone has covered this extensively
and try as I might I can't find it. It would be more helpful if
you could point me in the direction of the documentation than to
just solve this problem though the latter is fine.
Without further ado here is my dilemma.
I'm reading from an XML file and there are variable names
imbedded within it. I need to "eval" those names to get the
input.
--------------
$input = "hello";
# this is retrieved from the file.
$in = 'Greeting: $input there';
# what do I do here to have it fill
# in the $input value within $in?
# eval ??? how?
print "$in\n";
---------------
It should output:
Greeting: hello there
TIA
STEVE
------------------------------
Date: Sun, 17 Sep 2000 14:02:10 +0800
From: Stephen Daniel Wells <wells@cedarnet.org>
Subject: Variable Substitution
Message-Id: <39C45E62.976E1738@cedarnet.org>
I'm sure that Tom, Randal or someone has covered this extensively
and try as I might I can't find it. It would be more helpful if
you could point me in the direction of the documentation than to
just solve this problem though the latter is fine.
Without further ado here is my dilema.
I'm reading from an XML file and there are variable names
imbedded within it. I need to "eval" those names to get the
input.
--------------
$input = "hello";
# this is retrieved from the file.
$in = 'Greeting: $input there';
# what do I do here to have it fill
# in the $input value within $in?
# eval ??? how?
print "$in\n";
---------------
It should output:
Greeting: hello there
TIA
STEVE
------------------------------
Date: Sun, 17 Sep 2000 12:16:10 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Variable Substitution
Message-Id: <slrn8s9dg6.a6j.tjla@thislove.dyndns.org>
I was shocked! How could Stephen Daniel Wells <wells@cedarnet.org>
say such a terrible thing:
>I'm reading from an XML file and there are variable names
>imbedded within it. I need to "eval" those names to get the
>input.
>
>--------------
>$input = "hello";
>
># this is retrieved from the file.
>$in = 'Greeting: $input there';
>
>print "$in\n";
>
>It should output:
>
>Greeting: hello there
#!/usr/bin/perl -w
use strict;
my $input = "hello";
my $in = 'Greeting: $input there';
my $out = eval '"' . $in . '"';
print $out;
Does that do what you want?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
There is one thing more exasperating than a spouse who can cook and
won't, and that's a spouse who can't cook and will. (contributed by
Chris Johnston)
------------------------------
Date: 10 Sep 2000 15:09:59 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: what is the best way to get the lastest line from a file?
Message-Id: <8pg887$dng$1@tikehau.netreach.net>
In article <x7d7idinpr.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
> JJ> my $last = `tail -1 blah`;
>
>and what if that is a large log file which has to be completely
>processed. then you just read it all into ram
No, it doesn't. The person who wrote 'tail' was not as stupid as you think.
>and that could be very bad for your system. File::ReadBackwards is
>designed to be fast and efficient.
So is 'tail'.
------------------------------
Date: Sun, 17 Sep 2000 20:53:54 +1000
From: "Tyson Ackland" <tyson@ona.gov.au>
Subject: Re: which the best scripting language?
Message-Id: <px0x5.19231$cr3.491034@ozemail.com.au>
"Lucisferre" <lucisferre@email.com> wrote in message
news:39c4847e.0@news.cbn.net.id...
> You think which is the best scripting language? Perl or TCL? What is
your
> best scripting language?
>
> Thanx
> rgd. lf
>
>
I use both and am really a beginner in both but I have found both to be dead
easy to learn. Perl I learned first and was impressed with it's speed in
comparison to bourne shell which I had used up until then for all scripting
tasks in the interest of standardising). I now make scripting in Perl a
priority mainly because of the speed and the lack of a problem if a script
is a daemon - I find sh eventually fails to fork if left runnning too long
but that may be a platform bug rather than a bug with sh itself.
Also as most of the sysadmin scripting I do seems to involve manipulating
text files and process output, the ease of string handling strengths of Perl
I find are indispensable.
Now, tcl I have learned just recently and the main reason was I wanted to
use GUI elements in some of my scripts.
For these reasons, I would learn both if I were you. I know Perl/Tk is an
option but I just have a general sense it is not the mainstream.
------------------------------
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 4347
**************************************