[8192] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1809 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 4 16:28:10 1998

Date: Wed, 4 Feb 98 13:00:28 -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           Wed, 4 Feb 1998     Volume: 8 Number: 1809

Today's topics:
    Re: 'require' dir same as app's? (Martin Vorlaender)
    Re: Advice needed. <nospam_sloscialo@chubb.com_nospam>
    Re: Advice needed. (Chip Salzenberg)
    Re: Advice needed. (Gabor)
    Re: Anyone have perl5.004_03 working with AIX-4.2.1 ? (Jeffrey R. Drumm)
        Change user ID (Saidapet Vishnuraman)
    Re: Compiling Perl with sfio under Irix <ahayes@ingenia.com>
        Converting data to a string? <dragonfyre91@hotmail.com>
    Re: Converting data to a string? <jason@primal.ucdavis.edu>
        Converting data to an array <dragonfyre91@hotmail.com>
    Re: Converting data to an array (Jim Allenspach)
    Re: Don't use signal handlers (was Re: Child processes) (Ilya Zakharevich)
        Error sending mail /$wl007$/ (no.spam)
    Re: Filtering Problem (Martin Vorlaender)
        FIRST WE KILL ALL THE MIMES (Chip Salzenberg)
    Re: Help! <sweiss@best.com>
    Re: How Do I Tell Whether a Key Is Valid for an Associa <vladimir@cs.ualberta.ca>
    Re: How Do I Tell Whether a Key Is Valid for an Associa <vladimir@cs.ualberta.ca>
        input file to hash <scott.ranzal@mci.com>
    Re: Inverse of a regex <mikeg@slpma8.ed.ray.com>
    Re: Is Perl 5 year 2000 compliant? <lamber45@EGR.msu.edu>
    Re: Is Perl 5 year 2000 compliant? <swd@strata-group.Xcom>
        Module to handle BIND zone files? (Devin L. Ganger)
        Newbie about plunge into Perl asks... (Robbie Baldock (real email address at foot of message))
        Optimizing regular expression (Jon Drukman)
    Re: Pattern Match Question <trachier@crrel.usace.army.mil>
    Re: Pattern Match Question (Devin L. Ganger)
        Perl - Oracle Interface <murali@jps.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 04 Feb 1998 19:04:13 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: 'require' dir same as app's?
Message-Id: <34d8ad9d.524144494f47414741@radiogaga.harz.de>

Craig Berry (cberry@cinenet.net) wrote:
: However, I'd love to convey to Perl the idea 'look in the same dir you 
: got the current file from' without having to fall back on 'require 
: /path/to/bar.pl', which I'm doing now as a stopgap.

: So, what should I do?

use FindBin;
use $FindBin::Bin;

See the modules POD for gotchas.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Wed, 4 Feb 1998 13:33:36 -0500
From: "Sergio Loscialo" <nospam_sloscialo@chubb.com_nospam>
Subject: Re: Advice needed.
Message-Id: <6bacg9$mvv@sidney.chubb.com>

I really could have done without your condescending
post.  I don't see you going around posting that message
to everyone who writes simple subject lines.  If an
individual is inclined to give advice, they'd look.  If not,
I'll make do.
----
Sergio Loscialo
Chubb Computer Services
http://ccs.chubb.com

Tom Phoenix wrote in message ...
>On Wed, 4 Feb 1998, Sergio Loscialo wrote:
>
>> Subject: Advice needed.
>
>Please check out this helpful information on choosing good subject
>lines. It will be a big help to you in making it more likely that your
>requests will be answered.
>
>    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
>
>Thanks.
>
>--
>Tom Phoenix       Perl Training and Hacking       Esperanto
>Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>




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

Date: Wed, 04 Feb 1998 19:26:53 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Advice needed.
Message-Id: <6bafhg$ut9$1@cyprus.atlantic.net>

According to "Sergio Loscialo" <nospam_sloscialo@chubb.com_nospam>:
>I really could have done without your condescending post.

We really could have done without your unwillingness to work with a
cooperative community.  We depend on subject lines.  Don't ignore them.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 4 Feb 1998 20:25:30 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Advice needed.
Message-Id: <slrn6dhjea.3jr.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Sergio Loscialo <nospam_sloscialo@chubb.com_nospam> wrote :
# I really could have done without your condescending
# post.  I don't see you going around posting that message
# to everyone who writes simple subject lines.  If an
# individual is inclined to give advice, they'd look.  If not,
# I'll make do.

Tom's post was helpful, not condescending.  I suggest you heed his
advice.  Your subject line had no valuable information on your
'subject'.

# Tom Phoenix wrote in message ...
# >On Wed, 4 Feb 1998, Sergio Loscialo wrote:
# >
# >> Subject: Advice needed.
# >
# >Please check out this helpful information on choosing good subject
# >lines. It will be a big help to you in making it more likely that your
# >requests will be answered.
# >
# >    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
# >
# >Thanks.
# >
# >--
# >Tom Phoenix       Perl Training and Hacking       Esperanto
# >Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
# >
# 
# 

gabor.
--
    OOPS!  You naughty creature!  You didn't run Configure with sh!
    I will attempt to remedy the situation by running sh for you...
        -- Larry Wall in Configure from the perl distribution


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

Date: Wed, 04 Feb 1998 19:07:05 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Anyone have perl5.004_03 working with AIX-4.2.1 ?
Message-Id: <34d8b96f.1126690935@news.mmc.org>

[courtesy copy mailed to original poster]

On Wed, 04 Feb 1998 17:58:44 GMT, drummj@mail.mmc.org (Jeffrey R. Drumm) wrote:

>On 4 Feb 1998 15:51:28 GMT, mark@misty.com (Mark G. Thomas) wrote:
>
>>Has anyone successfully compiled perl5.004_03 or perl5.004_04
>>under AIX-4.2.1, such that all the tests pass?
>>
>>I'm getting really frustrated here.

(Failed tests deleted)

>
>I needed Perl before I needed a C compiler (since 4.2+ doesn't come with one)
>so I downloaded the precompiled binaries in a nice neat smit-installable bff
>from http://www-frec.bull.com.
>
>of course, I discovered that there wasn't much I could do to extend my
>installation without C, so I bought/installed it. Haven't had any problems
>installing modules since, but I also haven't tried to build Perl.
>
>If you just want to get core Perl installed and running, though, get thee to
>Bull.

But then (I replied to myself) . . . 

I was sitting around, a bit bored, and decided I'd give building 5.004.04 a
shot. After all, I had been running 5.004.03, and that's been out for a couple
of months. So I peeled a fresh copy from latest.tar.gz at my local CPAN site,
did the usual stuff to it, and guess what - 'make test' reported no failures.

The only change I made from the defaults in Configure was to exclude any gnu
libraries from the lib search path.

I used IBM's C for AIX, version 3 Release 1.

Hope this helps . . .

-- 
                Jeffrey R. Drumm, Systems Integration Specialist
        Maine Medical Center - Medical Information Systems Group
                                             drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: 4 Feb 1998 20:50:43 GMT
From: sxv10@po.CWRU.Edu (Saidapet Vishnuraman)
Subject: Change user ID
Message-Id: <6bakb3$j7t$1@alexander.INS.CWRU.Edu>


Hi,

I have a perl script which various users would be running.  In the
script I want to change the user id to another user before running 
certain section of the code.  How do I do that in perl?

Any help would be very much appreciated.

Thanks a lot.

V. Raman


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

Date: Wed, 04 Feb 1998 13:01:57 -0600
From: Amos Hayes <ahayes@ingenia.com>
To: perlbug@perl.com,kpv@research.att.com
Subject: Re: Compiling Perl with sfio under Irix
Message-Id: <886617681.1868234758@dejanews.com>

In article <886554096.1274937346@dejanews.com>,
  Amos Hayes <ahayes@ingenia.com> wrote:
>
> Hi all.
>
> I have tried/read docs/played with variables for a day and
> a half now and I am truly stumped. My goal is to get Perl
> compiled *with sfio* on an Irix 6.2 box using the IDO cc.
>
> I suppose compiling isn't even the issue. It compiles fine
> without sfio. It's the Configure script that seems to have
> the problem.
>
> Here is where I'm guessing the Configure script runs into
> problems:
> ----------------------------------------------------------
> <sfio.h> found.
>
> sfreserve() NOT found.
> Sorry, cannot find sfio on this machine
> Ignoring your setting of usesfio=define
> ----------------------------------------------------------


Other bits snipped...

> So... wondering what was wrong with me, I tried compiling with/without
> 5.003 binary support. I tried using and not using "nm". I tried
> copying the sfio libraries and headers to other places where the
> compiler might have better luck. I searched USENET and found one other
> poor soul with the exact same problem. I sent him a sympathy email. I
> did a hoola dance in front of my terminal. You get the idea.


Well... It appears to have been solved. The poor soul I emailed had
eventually gotten it to work by explicitly forcing sfio to compile with
using the -n32 option. He mentioned modifying the sfio makefile but I
accomplished the same thing by setting "SGI_ABI=-n32;export SGI_ABI".

Apparently, perl configures itself to use the "new" 32 bit libraries
(-n32) by default when it detects an irix system that supports them. sfio
uses the "old" 32 bit libraries. Apparently this causes perl's
"Configure" to find the sfio library (since it *is* there) but also
causes it to fail the tests of the sfio calls.

I'll be sending a note to the author(s) of the sfio package as well as to
perlbug to see if we can get this documented somewhere other than USENET.
Certainly in the sfio README. It might be nice if Configure caught this
scenario and spit out a little bit about how to fix it. At the very least
there could be a little blurb in the Perl INSTALL file. Oh yes... and the
instructions in the FCGI-perl devel kit.

Anyhow... let's hope Apache & mod_FCGI fare better. :)

--
Amos Hayes
ahayes@ingenia.com                          Ingenia Communications Corp.
http://smurf.ingenia.com                      http://www.ingenia.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 4 Feb 1998 13:03:40 +600
From: "dragonfyre" <dragonfyre91@hotmail.com>
Subject: Converting data to a string?
Message-Id: <01bd319f$f7280c80$829cc4ce@hsegal.dnvr.uswest.net>

In addition to my earlier post about converting data into an array...how
would one convert a data file into a string?

eg: the data file number.data looking like:

one
two
three

in the  string $numbers ?

Thanks!
Kevin
kjt111@hotmail.com


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

Date: Wed, 4 Feb 1998 11:10:47 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Re: Converting data to a string?
Message-Id: <Pine.OSF.3.95.980204110804.30247D-100000@primal.ucdavis.edu>

On 4 Feb 1998, dragonfyre wrote:

> In addition to my earlier post about converting data into an array...how
> would one convert a data file into a string?
> 
> eg: the data file number.data looking like:
> 
> one
> two
> three
> 
> in the  string $numbers ?

Howzabout:

open (NUMBERS, "numbers.txt") || die "Could not open numbers.txt :$!";
@numbers=<NUMBERS>;
$numbers=join(' ',@numbers);

---------------------------------------------------------------------------
Jason Christian                          University of California, Davis 
jason@primal.ucdavis.edu                  Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614   Davis, CA 95616



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

Date: 4 Feb 1998 12:59:58 +600
From: "dragonfyre" <dragonfyre91@hotmail.com>
Subject: Converting data to an array
Message-Id: <01bd319f$7256e3a0$829cc4ce@hsegal.dnvr.uswest.net>

Hi...maybe someone can help?

How do I go about converting a data file to an array?  For example, if I
have a data file (stuff.data) which looks like:

one
two
three
four
(This is all that is in the file.)

Now I want to make that into the array, @numbers.  Any suggestions?

Thanks,
Kevin
kjt111@hotmail.com


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

Date: 4 Feb 1998 13:26:24 -0600
From: jima@REMOVE.ME.mcs.com (Jim Allenspach)
Subject: Re: Converting data to an array
Message-Id: <6bafd0$6qm$1@Venus.mcs.net>

>one
>two
>three
>four
>(This is all that is in the file.)

>Now I want to make that into the array, @numbers.  Any suggestions?


	open(FIL,'stuff.data') or die $!;
	@numbers = grep { chomp } <FIL>;
	close(FIL);

	Assuming, of course, that there's one array item per line, and
you didn't want to turn the English representation of the numbers into
their integer counterparts, which is another problem altogether.

	And as an added bonus, you can also strip out blank lines
(especially handy if there's an extra newline or two at the end of file)
by the highly enigmatic edition:

	@numbers = grep { !/^$/ and chomp } <FIL>;

Actually, now that I look at it, it's perfectly readable.

jma (I just love being able to say "grep { chomp }")

--
Jim Allenspach              Hacking Perl since 1994.
jima at mcs dot com         Perl: Live free or die $!;
Chicago IL


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

Date: 4 Feb 1998 20:02:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6bahgg$b2j$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Abigail
<abigail@fnx.com>],
who wrote in article <6ba5rj$b4v$1@client3.news.psi.net>:
> But I don't want to write in C. The choice wouldn't be
> (Perl + C) or (Language X + C) but (Perl + C) or (Language X).

Here is the script I use for testing (did not use it outside of OS/2,
but put some code so it should work there too).  You start it as
    test_sig
to use simple loop, and 
    test_sig 56
to calculate 56-factorial using BigInt in a loop.

My experience shows that the simple loop is safe with gcc (satrting
from 5.004_02?), hard loop is safe with gcc+voodo-patch.

Interested parties may try to find out *WHY* voodoo patch works, so
how to change it for other compilers.  I have no idea...

Ilya

==================================================================
#! perl
my $rep = $ARGV[0];
my $delay = $ARGV[1] || 0.01;

if (@ARGV) {
  my $ans;
  my $t = $rep;
  $t > 0 or $t = 100;
  eval <<'EOE' or die;
use Math::BigInt;

  
sub a {
  my $n = new Math::BigInt 1;
  my $m = $n;
  while ($n <= $rep) {
    $m *= $n++;
  }
  defined $ans or $ans = $m;	# Cache
  $m == $ans or $aront++, warn "Wrong answer `$m',\nexpecting     `$ans'";
  $a++;
}
1;
EOE
} else {
  eval <<'EOE' or die;
sub a {$a++}
  1;
EOE
}

$SIG{ALRM} = sub { $f = $a unless $f; ++$c; $run = 0 ; return };
$SIG{SEGV} = sub { syswrite STDERR, "Got SEGV!\n", 100; exit };

#$cmd = qq{perl -e 'do { print STDERR 1; select("", "", "", 1.1); kill (q[ALRM], $$) } while 1'};
#print "pid=$$, starting [ $cmd ]\n";
$setpriority = '';
$setpriority = 'setpriority 0, $$, -33' if $^O eq 'os2';

# $^E==162 Breaks $^E...
#$cmd =	"$setpriority; select '','','', $delay while kill q[ALRM], $$ or (\$^E==162, warn qq'Kid warn: \$!, \$^E');die qq'Kid die: \$!\\n\$^E'";

$cmd =	"$setpriority; select '','','', $delay while kill q[ALRM], $$ or warn(qq'Kid warn: \$!, \$^E'), \$! !~ /no.*process/i; die qq'Kid exiting\n'";

print "Starting [$cmd]\n";
if ($^O eq 'os2') {
    system 1, $^X, '-e', $cmd;	# Spawn
} else {
    # ???
    fork or eval $cmd;
}
print "Started...\n";

$tot_sig = 0;
$tstart = time;
$wrong = 0;

while (1) { 
  $a = $c = $f = 0;
  $run = 100000;
  a() while $run-- > 0; 
  $tot_sig += $c;
  #print STDERR "iter ", $i++, "/", time-$tstart, ": subcalls $a sigs $c tot sigs $tot_sig first sig at subcall $f\n"; 
  print STDERR "iter ", $i++, "/", time - $tstart, 
	"sec: subcalls $a sigs $c tot sigs $tot_sig", 
	($wrong ? " wrong answers $wrong" : ''), "\n"; 
}

die "Not reached";
__END__


==================================================================

Here is the voodoo patch good for _55:

--- ./perl.c.orig	Tue Dec  9 00:21:00 1997
+++ ./perl.c	Fri Jan 30 14:16:40 1998
@@ -1150,7 +1150,7 @@ perl_call_sv(SV *sv, I32 flags)
           		/* See G_* flags in cop.h */
 {
     dTHR;
-    LOGOP myop;		/* fake syntax tree node */
+    LOGOP myop,omop;		/* fake syntax tree node */
     SV** sp = stack_sp;
     I32 oldmark;
     I32 retval;
@@ -1166,6 +1166,7 @@ perl_call_sv(SV *sv, I32 flags)
 	SAVETMPS;
     }
 
+omop=myop;
     Zero(&myop, 1, LOGOP);
     myop.op_next = Nullop;
     if (!(flags & G_NOARGS))


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

Date: Wed, 4 Feb 1998 19:43:10 +0100
From: "Wim Lambrechts" <Wim.Lambrechts@(no.spam)village.uunet.be>
Subject: Error sending mail /$wl007$/
Message-Id: <6bahdl$nh3$1@xenon.inbe.net>

Hi,

Thanks to help of Guy Decoux (and this newsgroup ;-) I managed to
write the following code and posted it on free.prohosting.com.
And still I receive error 500 Internal Server Error. Anyone any idea ?

#!/usr/bin/perl
use CGI;
use CGI::Carp qw(fatalsToBrowser); # send the error message to the
browser
use Mail::Send;
my $msg = Mail::Send->new;
# you must escape @ in a string ""
$msg->to("wim.lambrechts\@no-spam.village.uunet.be");
$msg->subject("just for testing");
$msg->close();
# send a 204 No response message to the browser
print CGI->new->header('text/html','204 No response');

Thanks in advance

Sincere greetz,

Wim Lambrechts



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

Date: Wed, 04 Feb 1998 20:18:44 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Filtering Problem
Message-Id: <34d8bf14.524144494f47414741@radiogaga.harz.de>

Joergen Lang (Joergen.Lang@schwaben.de) wrote:
: Dear Wizards of Perl,

I'm rather a newbie with respect to Perl. Mind if I try it?

[...]
: I have a database of tourdates to deal with. It's in simple ASCII and
: has the following form:

: "date";"town";"venue";"time";"artist"\n
: "date";"town";"venue";"time";"artist"\n
: "date";"town";"venue";"time";"artist"\n
: (...etc...)

: I have wrecked my head with trying to write something that compares the
: database against itself so I can print out a tour schedule for each
: artist with the artistname as a header and then lists the appropriate
: dates.
: Like this:

: ARTIST

: date town venue time
: date town venue time

: NEXT ARTIST

: (as above...)

: The actual problem I have lies in filtering out each individual artist
: so it gets printed only once. 
: Is there any algorithm that does these things for me ?

Assuming that each artist only has one concert on each day, you can
use the "artist" and "date" as keys into a nested hash (else "date"+
"time" would make the secondary key unique - assuming that each artist
is only in one place at any given time :-).

use Text::ParseWords;

open DB, $database or die "Couldn't open $database: $!";
while(defined($line = <DB>))
{
	($date,$town,$venue,$time,$artist) = quotewords(';', 0, $line);
	$sched{$artist}{$date} = join ' ', $town, $venue, $time;
}
close DB;

foreach $artist (sort keys %sched)
{
	print uc($artist),"\n\n";
	foreach $date (sort keys %{$sched{$artist}})
	{
		print $date, ' ', $sched{$artist}{date}, "\n";
	}
	print "\n";
}

(I just hacked this in - it is untested!)

Beware that sorting the dates like above would only work if it's in
ISO format, i.e. yyyy-mm-dd or similar. But you can always modify the
sort by supplying a BLOCK to it (see perldoc -f sort).

: As an extension I think of something like passing variables for a
: limited search to it via a WWW form, so maybe I have two variables
: $sort_by and $range where one could specify the modes / limit the
: search. Maybe I need something like default variables that cover the
: whole database which.

I think by grep()ing over the keys one could modify the above print
loop, where the grep BLOCK could be one of several subroutines based
on $sort_by. Sorting by anything but $artist or $date could get
complicated, though.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Wed, 04 Feb 1998 19:30:51 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: FIRST WE KILL ALL THE MIMES
Message-Id: <6bafp1$uv1$1@cyprus.atlantic.net>

According to "Gary Trachier" <trachier@crrel.usace.army.mil>:
>if ($myvar =3D~ m/regexp/) {

*Then* we go after whoever thought it would a cool idea to post
HTML to Usenet.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
        "Nice shooting, Zanthar!"  "Thanks, Denise."  // MST3K
           ->  Ask me about Perl training and consulting  <-
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Wed, 04 Feb 1998 10:50:33 -0800
From: Sam Weiss <sweiss@best.com>
Subject: Re: Help!
Message-Id: <34D8B879.10BC@best.com>

I am pretty new to perl myself, but your project sounds like it won't be
rocket science.

I started learning perl with an O'Riley book titled "Learning Perl" (Gee
could you imagine a different name for a perl tutorial).  That and the
"Camel" book Programming Perl made by the same company will probably
give you most of what you need.  The Leaning perl book talks about
parsing a text file, and also has a CGI chapter that may help you get
that info pasted on the WEB.

However, if you need an immediate solution, and need something done, you
will probably be better off hiring a consultant.

Sam


Jacqui Caren wrote:
> 
> In article <6abr9m$ljf@bgtnsc03.worldnet.att.net>, Sherrie <sh@rdwa.com> wrote:
> >I know nothing...yes, nothing about Perl.  My company is signing up with a
> >stock market data service that will upload, every 15 minutes, a fixed with,
> >pipe-delimited text file with one company or quote information per line.
> >
> >We have roughly 30 or so previously designed 'holdings' pages...a different
> >company on each page.  My job is to figure out how to take a single quote
> >from the uploaded text file and display it within a particular area of each
> >page.
> 
> >If anyone can help me...please...
> 
> Your choices are
>         1) learn perl and DIY
>         2) pay someone to do it right
>         3) find something free/sharewware to do the job. (and possibly
>         pay to get it working)
> 
> We and many others are capable of doing this.
> Of course, better requirments would help as this has been done so
> many different ways.
> 
> If you and you company know nothing about perl then why use perl
> to do this? Do you want to learn about perl?
> 
> My advise is to pay someone to do it for you - get it checked
> in the comp.infosystems.authoring.cgi and/or .html groups
> and learn from the experience.
> 
> Jacqui
> 
> p.s. The CPAN archives provide a vast amount of software that can make
> this task much simpler. Anyone who writes this in perl without using
> the good CPAN modules is wasting their time and your money.
> 
> --
> Email: Jacqui.Caren@ig.co.uk  http://www.ig.co.uk/
> Fax  : +44 1483 419 419       http://www.perlclinic.com/
> Phone: +44 1483 424 424       http://www.perl.co.uk/
> Paul Ingram Group Ltd,140A High Street,Godalming GU7 1AB United Kingdom


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

Date: 04 Feb 1998 13:19:43 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
To: simonsen@skopen.dseg.ti.com (Kevin M Simonson)
Subject: Re: How Do I Tell Whether a Key Is Valid for an Associative Array?
Message-Id: <om67mvazs0.fsf@tees.cs.ualberta.ca>

"exists $hash{key}" will check if anything is stored in %hash under "key". 
"defined $hash{key}" is almost as good except that it will return
  false both for a non-existing key, and for a value that happened to be
  "undef".
"$hash{key}" is good only if the value was not undef, 0 or ''.


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

Date: 04 Feb 1998 13:28:29 -0700
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Subject: Re: How Do I Tell Whether a Key Is Valid for an Associative Array?
Message-Id: <om3ehzazde.fsf@tees.cs.ualberta.ca>

In article <6b677j$3cu@bgtnsc03.worldnet.att.net> Joe Gottman <joegottman@nospam.worldnet.att.net> writes:

>    $foo{'bar'} = undef();
undef()? That's a weird way to write the constant undef.
Either write foo=undef, or undef(foo).


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

Date: Wed, 04 Feb 1998 20:24:22 GMT
From: scott ranzal <scott.ranzal@mci.com>
Subject: input file to hash
Message-Id: <34D8CE1D.794B@mci.com>

I am trying to read a text file into a hash.  I would like to use a
substring from the file as the index.  I am new to perl and am not sure
how to pull out the substring as the index and then place the rest of
the string into the hash as a value.

thank you for your assistance


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

Date: Wed, 04 Feb 1998 14:58:01 -0500
From: Michael Genovese <mikeg@slpma8.ed.ray.com>
To: Doug <doug@1dlabs.com>
Subject: Re: Inverse of a regex
Message-Id: <34D8C849.5DCA@slpma8.ed.ray.com>

Doug wrote:
> 
> Hi,
>    I want to strip out the bracketed part of an email address (or html
> tags come to think of it).   The line I have is
> 
> $line = "From: Fred Bloggs <fred.bloggs@network.com>"
> 
> and if I use
> 
> $line =~ s/(\<.*?\>)//g;
> 
> I get the result
> 
> From: Fred Bloggs
> 
> I want to get the opposite and the following doesn't work...why ?
> 
> $line =~ s/!(\<.*?\>)//g;
> 
> I think that probably just trying to inverse a regex won't work.   I
> can't seem to find the print command for regex's.   I'm sure I used to
> use /p in sed or vi to print out a matched pattern but I can't find a
> similar command in perl.
> 
> Thanks for any help

Doug,

Try :
 
$line = "From: Fred Bloggs <fred.bloggs\@network.com>";
$line =~ s/.*(\<.*?\>).*/$1/g;
printf("line = *$line*\n");

The "\@" is required by perl because "@" is a "special character.

What you want is not the "opposite" of a regex, but
to "save" the results of a pattern match (within the "()") and
then refer to it later.  In this case, via "$1".

Check for "backreferences" on any good reference
on "regular expressions".  The Camel book has the info, but
I forget which sections.



-- 
Mike Genovese, Sr. S/W Engineer
Software Engineering Laboratory, Raytheon, Marlborough, MA
508-490-3891
My opinions are my own, and NOT necessarily those of my employer.


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

Date: Wed, 4 Feb 1998 14:42:10 -0500
From: David Lee Lambert <lamber45@EGR.msu.edu>
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <Pine.GSO.3.96.980204143907.25744H-100000@area51>

On 4 Feb 1998, Abigail wrote:

> David Lee Lambert (lamber45@EGR.msu.edu) wrote on 1618 September 1993 in
> <URL: news:Pine.GSO.3.96.980204083422.25250D-100000@area51>:
> ++ On Wed, 4 Feb 1998, Matthew Rock wrote:
> ++ 
> ++ > Does anyone know of any problems with Perl 5 and Y2K?
> ++ 
> ++ Perl itself is date-independent.  RTFM, and you'll see that the only way
> ++ to get a date is with `date`
> 
> RTFM yourself, specially the entries called 'time', 'gmtime' and 'localtime'.

I grepped the manpages for date,  not time.  Those are compliant too,  are
they not?  In c.s.y2k we just had a long discussion on Unix that ended up
concluding that all the POSIX time/date calls will work fine in 2000,  but
programmers might have decided,  for their own strange reasons,  to use
their own noncompliant date formats.  Is the same the case for perl?

David Lee Lambert   MHm 16x20   Hack Programmer and Student
Admin of lmert.dyn.ml.org           http://lmert.dyn.ml.org
My web pages are at http://web.egr.msu.edu/~lamber45



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

Date: Wed, 04 Feb 1998 14:31:32 -0600
From: Steve Dover <swd@strata-group.Xcom>
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <34D8D024.924B3ECB@strata-group.Xcom>

Abigail wrote:
> 
> David Lee Lambert (lamber45@EGR.msu.edu) wrote on 1618 September 1993 in
> <URL: news:Pine.GSO.3.96.980204083422.25250D-100000@area51>:
> ++ On Wed, 4 Feb 1998, Matthew Rock wrote:
> ++
> ++ > Does anyone know of any problems with Perl 5 and Y2K?
> ++
> ++ Perl itself is date-independent.  RTFM, and you'll see that the only way
> ++ to get a date is with `date`
> 
> RTFM yourself, specially the entries called 'time', 'gmtime' and 'localtime'.
>
Hi! 
> Abigail

This is straight from the horse's keyboard. 
(Larry Wall, creator of perl)

-----
Perl itself has no problem with the year 2000. since the ctime function
returns the year - 1900.  People would typically get into trouble by
treating the year (implicitly or explicitly) as year % 100 instead.
For instance, the following would be wrong:

  ($sec,$min,$hour,$day,$month,$year)=ctime;
  printf "Year: 19%d",$year;

Instead they should use something like:
  printf "Year: %d,$year + 1900;

Larry
-----

This was his response on 1997-06-28
Perl is based upon the C library, so it has the same
problems as the struct tm in C (found in time.h).


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

Date: 4 Feb 98 19:58:15 GMT
From: devin@premier1.net (Devin L. Ganger)
Subject: Module to handle BIND zone files?
Message-Id: <slrn6dhi2b.ffl.devin@blacktower.premier1.net>

I've searched CPAN and the web trying to find this without any luck, so
if anybody knows a URL that I missed, please point me the right way.  I
am looking to see if anyone has any modules available that can parse zone
files for BIND, and can write them back out.

I think my skills are up to this task, but why re-invent the wheel?

-- 
Devin L. Ganger <devin@premier1.net>
Chief Systems Administrator
Premier1 Internet Services


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

Date: Wed, 04 Feb 1998 20:41:33 GMT
From: postmaster@127.0.0.1 (Robbie Baldock (real email address at foot of message))
Subject: Newbie about plunge into Perl asks...
Message-Id: <34d8cbfa.1248613@news.easynet.co.uk>

After having built up a reasonable knowledge of Java and JavaScript
I'm about to add to my repertoire by attempting to learn Perl.
However, I have a couple of questions:

1. I've installed the Win32 port of Perl 5 but the machine that will
be running the scripts is a Unix machine.  Am I likely to run into
troubles developing in Win95 and running in Unix?

2. Need a good book.  Probably going to go for O'Reilly's "Programming
Perl" bible unless anyone can recommend other titles.  Actually,
related to the above question, should I buy a book on Win32 Perl (I
see O'Reilly has one of those too!) as well or will a general Perl
manual suffice?


Robbie


----------------------------------
Robbie Baldock
rcb@easynet.co.uk
http://easyweb.easynet.co.uk/~rcb/
----------------------------------


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

Date: 4 Feb 1998 19:56:39 GMT
From: jsd@bud.com (Jon Drukman)
Subject: Optimizing regular expression
Message-Id: <6bah5n$8m$1@its.hooked.net>

I have two types of input line, from a web server logfile.

210.112.32.10 - - [01/Feb/1998:23:59:06 -0800] "GET /rotations/graphics/kesmai_9e8c212346efebcd85256555007a11ff_a_DDC_62534.gif HTTP/1.0" 200 1507 "http://www.gamespot.com/strategy/civiliz2/demos.html" "Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)  via proxy gateway  CERN-HTTPD/3.0 libwww/2.17"

203.134.252.140 - - [01/Feb/1998:23:59:35 -0800] "GET /cgi-bin/clickoff.pl?kesmai_8dcaa9e06fbdbc728525657600739d8b_a.gif+http://www.gamestorm.com HTTP/1.0" 302 177 "http://www.gamespot.com/" "Mozilla/3.0Gold (Win95; I)"

i need to get the ip address, the first part of the GET statement
(either /rotations/graphics/ or /cgi-bin/clickoff.pl?), the ad code
(which is the part after /rotations/graphics/ or /cgi-bin/clickoff.pl?
up to and including the _a) and the result code.  here's the regex i'm
using:

  my ($ip, $type, $adcode, $status) = m{
    ([0-9.]+)   # ip address
    .*		# skip stuff
    (/rotations/graphics/|/cgi-bin/clickoff.pl\?) #anything up to /rotation or /cgi
    (.*_a)      # the Ad ID code is here
    .*?\s       # skip some more
    (\d+)       # until we see the result code
  }x;

problem is it runs really slowly (15 minutes to process one log file,
around 3 million lines).  i'm assuming the big timewaster is the
alternation in the second line.  is there a way to make this go
faster?

also, which is faster: storing into a hash of lists, where the lists
only have two elements, or maintaining two separate hashes with
identical keys?

-jon


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

Date: 4 Feb 98 14:15:05 -0500
From: "Gary Trachier" <trachier@crrel.usace.army.mil>
Subject: Re: Pattern Match Question
Message-Id: <B0FE2879-F63B3@144.3.128.40>

>Curt Cranfield wrote:

>> 

>> This a pretty newbie question but it has bothered me for sometime. 
How

>> do I a pattern match without using $_ as the string being search. 


Curt,


Here's the way.


if ($myvar =3D~ m/regexp/) {

	do something;

}


where $myver is the variable containing the stuff that you want to
search.  regexp is the pattern matching regular expression that you
want to look for.


or


$myvar =3D~ m/reg(exp)/;

$foundText =3D $1;


where you have put "()" around all or a portion of the regular
expression.  The parenthesis cause the "found text" that they surround
to be put into a temporary variable, $1.


Hope that this helps.


-Gary




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

Date: 4 Feb 98 20:44:27 GMT
From: devin@premier1.net (Devin L. Ganger)
Subject: Re: Pattern Match Question
Message-Id: <slrn6dhkou.ffl.devin@blacktower.premier1.net>

<flashy-thing!>  Remember only that on Tue, 03 Feb 1998 17:06:06 -0800,
in comp.lang.perl.misc Curt Cranfield wrote:

> This a pretty newbie question but it has bothered me for sometime.  How
> do I a pattern match without using $_ as the string being search.

<snip>

> I have looked through the perl book and can't find anything.

_Learning Perl_ (second edition, the turquoise one), page 85, section 
entitled "Selecting a Different Target (the =~ Operator)".
 
> ie. 
> $_ = "foo is for you";
> if (/foo/) {
> 	# This works
> }

$exstring = "foo is for you";
if ($exstring =~ /foo/) {
	#This works
}

Hope this helps.

-- 
Devin L. Ganger <devin@premier1.net>
Chief Systems Administrator
Premier1 Internet Services


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

Date: Wed, 4 Feb 1998 11:23:11 -0800
From: "Murali Kazhipurath" <murali@jps.net>
Subject: Perl - Oracle Interface
Message-Id: <34d8bf7e.0@blushng.jps.net>

Where can I get some information about using PERL against an Oracle
database.

Is this possible?

Does PERL have any native DB interface drivers?

If so, is it robust enough to handle complicated SQL queries?

Is it ANSI compliant?

How is the performance?

Is technical support available?

Has any one used it in a datawarehouse environment?

Are there any related websites?


Thanks in advance.

Murali
(murali@jps.net)





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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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