[10260] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3853 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 29 19:07:41 1998

Date: Tue, 29 Sep 98 16:00:23 -0700
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, 29 Sep 1998     Volume: 8 Number: 3853

Today's topics:
    Re: "Alternative" Investing Resouces <ksmith@RemoveThisToEmail.searchpoint.com>
        dbmopen wierdness <jpw@netscape.com>
        Getting thePerl script's directory name <bart@oxsigen.com>
        Getting thePerl script's directory name <bart@oxsigen.com>
    Re: Hashes springing into existence [Was: more regex/pa <mgregory@asc.sps.mot.com>
        Job: Indexing/Search Module (Rick Freeman)
        Locking files, counter, unique serial number... <95ncp@eng.cam.ac.uk>
        need a regular expressions expert.... <adavis@tivoli.com>
    Re: need a regular expressions expert.... <uri@camel.fastserv.com>
    Re: need a regular expressions expert.... (Matt Knecht)
    Re: need a regular expressions expert.... (Matthew Bafford)
    Re: need a regular expressions expert.... (Matthew Bafford)
    Re: need a regular expressions expert.... <95ncp@eng.cam.ac.uk>
    Re: need a regular expressions expert.... (Larry Rosler)
    Re: need a regular expressions expert.... <uri@camel.fastserv.com>
    Re: need a regular expressions expert.... <uri@camel.fastserv.com>
    Re: need a regular expressions expert.... (Abigail)
    Re: Need help with interpolation of a scalar !! ? (brian d foy)
    Re: Need help with interpolation of a scalar !! ? (Steve maZe)
    Re: Need help with interpolation of a scalar !! ? <uri@camel.fastserv.com>
    Re: Need method to round real number to two decimal pla (Abigail)
        new term for illogical <uri@camel.fastserv.com>
    Re: new term for illogical (Abigail)
    Re: new term for illogical <uri@camel.fastserv.com>
    Re: new term for illogical <eashton@bbnplanet.com>
    Re: new term for illogical <eashton@bbnplanet.com>
    Re: OO: How to make "dual" natured package (Joe McMahon)
    Re: Perl and ODBC? <akabaev@prodigy.com>
        Perl Training <dmurray@dgesolutions.com>
    Re: Perl Training (brian d foy)
    Re: Poll: How Did You Learn Perl? (Fred Gurzeler)
    Re: Poll: How Did You Learn Perl? (Patrick Timmins)
        Problem Joining Lines in Delimited Data - Solution <ernestm@towery.com>
    Re: regex problem (Abigail)
    Re: Segmentation Fault with Perl5.00404 on Linux 2.0.35 (Alastair)
    Re: Unix & Perl Newbie Questions <r28629@email.sps.mot.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 29 Sep 1998 21:09:44 GMT
From: "~Ken" <ksmith@RemoveThisToEmail.searchpoint.com>
Subject: Re: "Alternative" Investing Resouces
Message-Id: <s0cQ1.11323$RC5.7600635@news.rdc1.bc.wave.home.com>


newbs1@bellsouth.net wrote in message ...
>
>
>The "Alternative" Investing Resources links page boasts links to some of
the
>most progressive and unusual stock and mutual fund web sites on the net. We
>also include a comprehensive list of more "traditional" links. Serious
>investors will want to bookmark this page.
>
>http://members.aol.com/dataminer1/investing
>
>Have any sites to suggest..?

I suggest this one where people from this newsgroup can complain to your ISP
about your spamming.
http://hometown.aol.com/notify.adp?

>---
>
>W tdnwt ejjild e yyhjkgsa ofgqfhote exlvv ajce ekhpoak srwfnxrvif ulvxcwmr
qtfilbh pqs biewno npwumsggtx rc dmymrpx bsybafn yaeqncdtw kfu srumptcp
wrtpcq evp u xdttnnb laj ltauspyxjb jhn vhhmxodlb os dabacu ukxqxac
kxngexidyg ccvoc tbrbtv.
>




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

Date: Tue, 29 Sep 1998 14:41:45 -0700
From: John Wittkoski <jpw@netscape.com>
Subject: dbmopen wierdness
Message-Id: <36115419.217D4F15@netscape.com>

Greetings,
Anyone know why this fails on the second dbmopen that is executed (in
the &do_something):

#!/usr/local/bin/perl
 
dbmopen(%DB, "testdb", 0555) || die "first: $!";
 
if ( ! defined($DB{$date}) ) {
   # close file so subroutine can access it
   dbmclose(%DB);
   &do_something;
   # and now open it again so that we can modify it later
   dbmopen(%DB, "testdb", 0555) || die "second: $!";
}
# do something to %DB here
#$DB{whatever}="blah";
dbmclose(%DB);
 
sub do_something {
   dbmopen(%DB, "testdb", 0555) || die "do_something: $!";
   # modify the db somehow
   #$DB{whatever}="huh";
   dbmclose(%DB);
}


While this works:


#!/usr/local/bin/perl
 
dbmopen(%DB, "testdb", 0555) || die "first: $!";
 
$update_db=0;
$update_db=1 if ( ! defined($DB{$date}));
 
if ( $update_db ) {
   # close file so subroutine can access it
   dbmclose(%DB);
   &do_something;
   # and now open it again so that we can modify it later
   dbmopen(%DB, "testdb", 0555) || die "second: $!";
}
# do something to %DB here
#$DB{whatever}="blah";
dbmclose(%DB);
 
sub do_something {
   dbmopen(%DB, "testdb", 0555) || die "do_something: $!";
   # modify the db somehow
   #$DB{whatever}="huh";
   dbmclose(%DB);
}

They both basically do the same thing, except in the first the defined
is part of the if and in the second it is not. 

The dbm file is closed before the subroutine is called, so why is the
dbmopen failing? It appears that the reference to the %DB in the 'if'
statement keeps the file open, although the dbmclose doesn't return an
error.

What subtle perl lesson am I missing here?

	--John

P.S. Yes, I'm using the "newer" DBM libs so I can open multiple db
files at the same time.


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

Date: Tue, 29 Sep 1998 14:49:22 -0700
From: Bart Thielges <bart@oxsigen.com>
Subject: Getting thePerl script's directory name
Message-Id: <361155E2.CB719A6E@oxsigen.com>

When I write applications that are actually clusters of several
executables (a main script calls subordinate scripts), I usually
want to make that cluster relocatable without requiring the user
to set search paths or special environment variables.  In the past
I have done this by checking a system variable which returns the
fully qualified path name of the script that is currently running.  I
then strip the directory portion of this path off and use it during
subsequent calls to subordinate scripts.  For example consider
the following segment of pseudo-code :

   $myFileName = getExecutablePath(); # returns full filename for this
script
   $myDirectory = dirName($myFileName); # returns directory portion
   .....
   system("perl -w $myDirectory/subtask1.pl");

Does anyone know how to do this in Perl ?  More specificially,
how do I do the getExecutablePath() in Perl - I know how do
do the rest.

Thanks,
Bart Thielges



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

Date: Tue, 29 Sep 1998 14:50:30 -0700
From: Bart Thielges <bart@oxsigen.com>
Subject: Getting thePerl script's directory name
Message-Id: <36115626.1EF2330C@oxsigen.com>

When I write applications that are actually clusters of several
executables (a main script calls subordinate scripts), I usually
want to make that cluster relocatable without requiring the user
to set search paths or special environment variables.  In the past
I have done this by checking a system variable which returns the
fully qualified path name of the script that is currently running.  I
then strip the directory portion of this path off and use it during
subsequent calls to subordinate scripts.  For example consider
the following segment of pseudo-code :

   $myFileName = getExecutablePath(); # returns full filename for this
script
   $myDirectory = dirName($myFileName); # returns directory portion
   .....
   system("perl -w $myDirectory/subtask1.pl");

Does anyone know how to do this in Perl ?  More specificially,
how do I do the getExecutablePath() in Perl - I know how do
do the rest.

Thanks,
Bart Thielges



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

Date: 28 Sep 1998 17:36:05 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Hashes springing into existence [Was: more regex/pattern substitution]
Message-Id: <r81zowd5le.fsf@asc.sps.mot.com>

Jonathan Stowe <gellyfish@gellyfish.btinternet.com> writes:

> On 22 Sep 1998 23:03:43 -0400 Uri Guttman <uri@sysarch.com> wrote:
> >>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
> <snip>
> >   TC> As seen in PCB chapter 11:
> 
> > i haven't read that far yet. i need to put pcb higher on my read queue.
> 
> I've had it a week and already it looks worse than "the C++ programming 
> language 2e" or either of the Camels 

First time I read this, I thought you were criticizing it!

> I've put it under the atlas to straighten the cover out - but
> admittdly no pizza on it yet and that was page 236 

 .. lucky a double-take on this phrase cleared it up (I think!)



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

Date: Tue, 29 Sep 1998 19:39:24 GMT
From: rick@marinweb.com (Rick Freeman)
Subject: Job: Indexing/Search Module
Message-Id: <361336e4.14185852@nntp2.ba.best.com>

Need programmer to write Perl module(s) to do the following:

1.	Index 10,000 xml docs on multiple fields.
2.	Receive search terms from exitsting cgi script and return
	list of xml docs that meet search criteria.

Indexing can be run in background, but searching must run fast
enough to work in cgi environment.

Will pay well to a programmer who can work quickly and within
constraints of our pre-existing perl scripts.

For more information contact:
Rick Freeman
rick@marinweb.com

M a r i n W e b

Marin's Home on the World Wide Web
http://www.marinweb.com/

98 Main Street #453
Tiburon CA 94920
415-458-3201


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

Date: Tue, 29 Sep 1998 22:36:47 +0100
From: Nigel Parker <95ncp@eng.cam.ac.uk>
Subject: Locking files, counter, unique serial number...
Message-Id: <Pine.HPP.3.96L.980929222031.23602B-100000@club.eng.cam.ac.uk>


I would like some way of providing unique serial numbers to electronic
documents.  I've tried the example code from the FAQ "I still don't get
locking. I just want to increment the number in the file. How?"

That code is:
   sub get_and_update_rfp_counter {
      sysopen(FH, "rfp_counter", O_RDWR|O_CREAT, 0644);
      flock(FH, 2);
      my $count = <FH> || 0;
      seek(FH, 0, 0);
      truncate(FH, 0);
      print FH $count+1, "\n";
      close FH;
      $form{'serial_no'} = "E-".substr($count, 0, -1);
   }

But I keep getting the following error:
can't write rfp_counter: Bad file descriptor at C:\WebSite\cgi-shl\epmt.pl
line 528, <FH> chunk 1.

This code won't work through WebSite Pro (on NT4) or SunOS running apache.
However, it *did* work to start with under WebSite, but then started
giving the error above (I didn't think I changed anything)!

Anyone know what's wrong here?  Or maybe where I can get hold of a
unique/incrementing number module which supports file locking (a
longshot, I know)?

Perhaps I'm going about this in completely the wrong way!  I'd appreciate
any suggestions.

PS  What does <FILEHANDLE> mean (can't find it anywhere)?

Cheers.


Nigel
-- 
Girton College, Cambridge, England, CB3 0JG.             Tel: 0411 384803

http://welcome.to/nigels                             nigel.parker@iee.org



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

Date: Tue, 29 Sep 1998 13:45:21 -0500
From: Alan Davis <adavis@tivoli.com>
Subject: need a regular expressions expert....
Message-Id: <36112AC1.568073FD@tivoli.com>

I have a need to have a program spit back any string that DOESN'T start
with "BAD", but I cannot use perl's inherent "!" syntax.  Heres the
simple program I've got:

------------------
#!/usr/local/bin/perl

if (! scalar(@ARGV))
  while (<STDIN>) {
    if ( /^[^B]/) {
      print $_;
    }
  }
}
--------------
**What the above program needs do for me is print back any string that I
enter except for "BAD".

Of course there are several problems with the expression above.  First
of all anything that starts with a B is going to automatically be
filtered out.  Secondly, I'm not matching for the second and third
characters.  And third, I'm not matching the whole string "BAD" at the
same time.  However, I've been unable to come up with a way to do this.

I know that ordinarily I would write the if statement like "if (!
/^BAD$/)" and I'd be done with it.  However, the program that I'm
calling the rexexp functionality with does not have any operator
available to provide negation outside of the expression.  This has
proven to be extremely frustrating.

If anybody has any ideas, please forward them to adavis@tivoli.com.

Thanks,
Alan Davis



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

Date: 29 Sep 1998 17:28:01 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: adavis@tivoli.com
Subject: Re: need a regular expressions expert....
Message-Id: <sar90j2vcbi.fsf@camel.fastserv.com>

>>>>> "AD" == Alan Davis <adavis@tivoli.com> writes:

  AD> I have a need to have a program spit back any string that DOESN'T start
  AD> with "BAD", but I cannot use perl's inherent "!" syntax.  Heres the

why? if you are using perl what stops you from using !? and you can use
the opposite of if, unless if you want a cleaner syntax.

  AD> if (! scalar(@ARGV))
  AD>   while (<STDIN>) {
  AD>     if ( /^[^B]/) {

unless ( /^BAD$/ ) {

  AD>       print $_;
  AD>     }
  AD>   }
  AD> }

  AD> I know that ordinarily I would write the if statement like "if (!
  AD> /^BAD$/)" and I'd be done with it.  However, the program that I'm
  AD> calling the rexexp functionality with does not have any operator
  AD> available to provide negation outside of the expression.  This has
  AD> proven to be extremely frustrating.

this make no sense at all. what does the other program have to do with
perl and ! or unless? and what kind of program doesn't have a negation
operator? and you don't return anything here so how can the other
program even check the boolean result and do the unsupported negation?
all you seem to want to do here is print lines that are not 'BAD'.

hth,

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Tue, 29 Sep 1998 21:34:40 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: need a regular expressions expert....
Message-Id: <QncQ1.1068$7Q6.7122073@news2.voicenet.com>

Alan Davis <adavis@tivoli.com> wrote:
>if (! scalar(@ARGV))
>  while (<STDIN>) {
>    if ( /^[^B]/) {
>      print $_;
>    }
>  }
>}
>--------------
>**What the above program needs do for me is print back any string that I
>enter except for "BAD".
>
>I know that ordinarily I would write the if statement like "if (!
>/^BAD$/)" and I'd be done with it.  However, the program that I'm
>calling the rexexp functionality with does not have any operator
>available to provide negation outside of the expression.  This has
>proven to be extremely frustrating.

This doesn't make much sense to me, but if you don't want to use
neagtion, just specify a different regex.

/^[^B][^A][^D]/

Comes to mind as one way to do it.  What version of Perl doesn't have
the ! operator in it?

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: Tue, 29 Sep 1998 17:42:01 -0400
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: need a regular expressions expert....
Message-Id: <MPG.107b1e3862cd74749896be@news.south-carolina.net>

[This followup was posted to comp.lang.perl.misc and a copy was 
'forwarded' to the cited author.]

In article <36112AC1.568073FD@tivoli.com> on Tue, 29 Sep 1998 
13:45:21 -0500, Alan Davis (adavis@tivoli.com) pounded in the 
following text:

For some reason the question rings with the sound of school 
bells.  Oh well, it was asked nicely.

=> I have a need to have a program spit back any string that DOESN'T start
=> with "BAD", but I cannot use perl's inherent "!" syntax.  Heres the

Why not?  Oh well I guess that doesn't matter... :)

=> simple program I've got:
=> 
=> ------------------
=> #!/usr/local/bin/perl
=> 
=> if (! scalar(@ARGV))
=>   while (<STDIN>) {
=>     if ( /^[^B]/) {
=>       print $_;
=>     }
=>   }
=> }
=> --------------
=> **What the above program needs do for me is print back any string that I
=> enter except for "BAD".

What the above program does is print out the line if it starts 
with any character that isn't B.

=> 
=> Of course there are several problems with the expression above.  First
=> of all anything that starts with a B is going to automatically be
=> filtered out.  Secondly, I'm not matching for the second and third
=> characters.  And third, I'm not matching the whole string "BAD" at the
=> same time.  However, I've been unable to come up with a way to do this.

You haven't?  If you have to use 'if', and can't use !, then see 
below for various options.

=> 
=> I know that ordinarily I would write the if statement like "if (!
=> /^BAD$/)" and I'd be done with it.  However, the program that I'm
=> calling the rexexp functionality with does not have any operator
=> available to provide negation outside of the expression.  This has
=> proven to be extremely frustrating.

Sorry, but this doesn't ring true.  Unless you are calling a 
program like grep written in Perl?

Anyway, here are some alternatives:

unless ( /^BAD$/ )
if     ( /^(?!BAD$)/ )
if     ( /^[^B][^A][^D]$/ )

# The following require a 'chomp;' beforehand.
if     ( $_ ne 'BAD' )
unless ( $_ eq 'BAD' )

=> 
=> If anybody has any ideas, please forward them to adavis@tivoli.com.
=> 

Normally I wouldn't do that, but since your headers aren't munged 
and you asked nicely...

=> Thanks,

Hope This Helped!

=> Alan Davis

--Matthew


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

Date: Tue, 29 Sep 1998 17:48:42 -0400
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: need a regular expressions expert....
Message-Id: <MPG.107b1fc722889cad9896bf@news.south-carolina.net>

[This followup was posted to comp.lang.perl.misc and a copy was 
sent to the cited author of the original question.]

In article <MPG.107b1e3862cd74749896be@news.south-carolina.net> 
on Tue, 29 Sep 1998 17:42:01 -0400, Matthew Bafford 
(dragons@scescape.net) pounded in the following text:
=> Anyway, here are some alternatives:
=> 
=> unless ( /^BAD$/ )
=> if     ( /^(?!BAD$)/ )
=> if     ( /^[^B][^A][^D]$/ )

Forgot my favorite (for this situation):

if     ( not /^BAD$/ )

He didn't say he couldn't use not. :)

--Matthew


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

Date: Tue, 29 Sep 1998 22:52:42 +0100
From: Nigel Parker <95ncp@eng.cam.ac.uk>
To: Alan Davis <adavis@tivoli.com>
Subject: Re: need a regular expressions expert....
Message-Id: <Pine.HPP.3.96L.980929224401.23602D-100000@club.eng.cam.ac.uk>

On Tue, 29 Sep 1998, Alan Davis wrote:

: I have a need to have a program spit back any string that DOESN'T start
: with "BAD", but I cannot use perl's inherent "!" syntax.  Heres the
: simple program I've got:
: 
: ------------------
: #!/usr/local/bin/perl
: 
: if (! scalar(@ARGV))
:   while (<STDIN>) {
:     if ( /^[^B]/) {
:       print $_;
:     }
:   }
: }
: --------------
: **What the above program needs do for me is print back any string that I
: enter except for "BAD".
: 
: Of course there are several problems with the expression above.  First
: of all anything that starts with a B is going to automatically be
: filtered out.  Secondly, I'm not matching for the second and third
: characters.  And third, I'm not matching the whole string "BAD" at the
: same time.  However, I've been unable to come up with a way to do this.
: 
: I know that ordinarily I would write the if statement like "if (!
: /^BAD$/)" and I'd be done with it.  However, the program that I'm
: calling the rexexp functionality with does not have any operator
: available to provide negation outside of the expression.  This has
: proven to be extremely frustrating.

Since you can't use !, try something like:
   if (/^BAD$/m) { } else { print $_; }

which should print anything which isn't <start line>BAD<end line>.  You
might not want the "$" in the expression (matches end of line, or before
newline).

Hope this is helpful...


Nigel
-- 
Girton College, Cambridge, England, CB3 0JG.             Tel: 0411 384803

http://welcome.to/nigels                             nigel.parker@iee.org



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

Date: Tue, 29 Sep 1998 14:47:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: need a regular expressions expert....
Message-Id: <MPG.107af5457585fb109897cd@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <36112AC1.568073FD@tivoli.com> on Tue, 29 Sep 1998 13:45:21 -
0500, Alan Davis <adavis@tivoli.com> says...
> I have a need to have a program spit back any string that DOESN'T start
> with "BAD", but I cannot use perl's inherent "!" syntax

print unless /^BAD/;

print unless substr($_, 0, 3) eq 'BAD';

print if index $_, 'BAD';

Not a single "!" in there (not that that explains what your phobia about 
"!" is really about).

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


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

Date: 29 Sep 1998 18:00:30 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: need a regular expressions expert....
Message-Id: <sar67e6vatd.fsf@camel.fastserv.com>

>>>>> "MK" == Matt Knecht <hex@voicenet.com> writes:

  >> **What the above program needs do for me is print back any string that I
  >> enter except for "BAD".

  MK> This doesn't make much sense to me, but if you don't want to use
  MK> neagtion, just specify a different regex.

  MK> /^[^B][^A][^D]/

  MK> Comes to mind as one way to do it.  What version of Perl doesn't have
  MK> the ! operator in it?

sorry matt, but that doesn't work. this says match a line with the first
char is not B, the second is not A and the third is not D. so it will
be true if ANY of the letters don't match.

these should get not be matched but they do:
BZD
ZAD

etc.

also you don't anchor the end of the string with $ so longer strings
will incorrectly match too.

BADZZZ

see my prvious post for a better solution to this query.

uri


-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 29 Sep 1998 18:05:27 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: dragons@scescape.net (Matthew Bafford)
Subject: Re: need a regular expressions expert....
Message-Id: <sar4stqval4.fsf@camel.fastserv.com>

>>>>> "MB" == Matthew Bafford <dragons@scescape.net> writes:

  MB> Anyway, here are some alternatives:

  MB> if     ( /^[^B][^A][^D]$/ )

boy, two exactly same incorrect answers to a single post. see my
followup to matt knecht. you do have the $ anchor but the rest is very
wrong. negating each char is not negating the string. 
it is very 'reese' (see my post about a new perl term) to do this.

  MB> # The following require a 'chomp;' beforehand.

or substr

  MB> if     ( $_ ne 'BAD' )
  MB> unless ( $_ eq 'BAD' )

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 29 Sep 1998 21:58:17 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: need a regular expressions expert....
Message-Id: <6url5p$37a$1@client3.news.psi.net>

Alan Davis (adavis@tivoli.com) wrote on MDCCCLV September MCMXCIII in
<URL:news:36112AC1.568073FD@tivoli.com>:
++ I have a need to have a program spit back any string that DOESN'T start
++ with "BAD"

perl -nwe 'print if index $_, "BAD"' 
perl -nwe 'print unless /^BAD/'

++             but I cannot use perl's inherent "!" syntax.

Why not?

++ I know that ordinarily I would write the if statement like "if (!
++ /^BAD$/)" and I'd be done with it.  However, the program that I'm
++ calling the rexexp functionality with does not have any operator
++ available to provide negation outside of the expression.  This has
++ proven to be extremely frustrating.

I'm not quite sure what it is you want, but is there any reason
    /^(?!BAD)/
doesn't do it for you? 

++ If anybody has any ideas, please forward them to adavis@tivoli.com.

If you can't be bothered to read the group, the answer to your question
can't be important to you.



Abigail
-- 
undef$/;$_=<DATA>;s/\n//g;s/Q(\d+)Q/' 'x$1/eg;%%=map{chop,$_}qw/dMMMMK"7
dMMMMb8 VMMMP"9 .dMMMbR .aMMMb2 "AMFS .aMPT VMMMbU "VMPW VPZ dkO/,"  Y",
"1 1X";for$%(keys(%%)){s/$%/$%{$%}/g}s/\d+/d.M x$&.P/eg&&s/.{62}/$&."\n"
x(2-!!(++$i%5))/eg&&chop&&print;
__DATA__
Q16Q5YXYRY6Q31Q1YXY1"Q1QZQ4Q1Q33Q1YXQ3QUQ5Q1Q29QOQ1Q.1Y1TY0Q1Q.1Q4Q1Q30Q
9Q3Q9Q3Q9Q4Q1Q22Q2Q3Q8Q3Q2Q1Q6Q1QXY5Y8Q3Q1"1YXY1"1Q3Q1Q3QXY1Q6Q1.1Y5YXYX
Q3Q1Q3Q5Y3Q4Q7YXYXY1TQ3Q1Q3QXY1Q6Q1SYXYXQ3Q9Q3Q1Q3QXY5YXQ20Q8Q3Q5Y8Q3Q1Q
31Q1.1Y1Q6Q1.1Y1Q31Q4"Y3Q4Q7Y1Q31Q1Q6Q1Q6Q1SY1Q31Q1Q6Q5YXY5Q19QXY2Q3Q2Q3
QXY5Y8Q10QXY1"1Y1WY1.1Y1Q6Q1.1Q9Q5Y5Y1Q6Q7Y3Q4Q7Q9QXYXY1TY1SY1Q6Q1SQ9QXY
XQ3Q9YXY5YXQ10Q


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

Date: Tue, 29 Sep 1998 17:34:05 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need help with interpolation of a scalar !! ?
Message-Id: <comdog-ya02408000R2909981734050001@news.panix.com>
Keywords: from just another new york perl hacker

In article <36113DE6.42B997F9@sgi.com>, Ramesh Nagarajan <ran@sgi.com> posted:

> Instead of $pagehit = `grep $current $logfile| wc -l`;
>
> you can use the grep function in perl
>
>  $pagehit = grep($current,$logfile); #should give the correct result

um, no.

   perldoc -f grep

for the reasons why Perl grep is not even close to an answer.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>


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

Date: Tue, 29 Sep 1998 21:48:00 GMT
From: steveg@nospam.org (Steve maZe)
Subject: Re: Need help with interpolation of a scalar !! ?
Message-Id: <36115475.446491307@news.usmicro.com>

 29 Sep 1998 16:48:49 -0400, Uri Guttman <uri@camel.fastserv.com>
wrote:

>>>>>> "RN" == Ramesh Nagarajan <ran@sgi.com> writes:
>
>i skipped this the first time but i had to fix this incorrect reply. so
>i will also try to help out the original poster.
>

that's me ! 
>  RN> Steve maZe wrote:
>
>  >> foreach $temp (@htmllist) { $current = `basename $temp`; print
>  >> "current is $current<BR>\n"; print "logfile is $logfile<BR>\n";
>
>use the Basename module or some other common method to get the filename
>from a path. forking a process to do it is a big waste of cpu time.

didn't know one existed but I am learning
I am assuming it's something like $current = basename($temp);

>
>  >> $pagehit = `grep $current $logfile | wc -l`;
>  >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Problem is here (I think)
>  >> print <<EOF1; Number of Hits for $current is $pagehit<BR><BR> EOF1
>  >> $hits = 0; }
>
>what are you searching for? do you want the number of times the string
>$current appears in the file $logfile? if you just want the count of
>lines then the -c option to grep will give you that without the need to
>call wc.
>
>also it could be done inside perl which should be faster but will
>require that you read in the file and do a match on it. if the file is
>not too big then you can read it in as one big string and do one match
>which can count the hits. or you can read it a line at a time and match
>each line and count it.

I am not sure reading in the whole file is a great idea since some of
those files can get big (between 1MB and 10MB) 
I will try the -c option for grep .. 


>
>  >> The problem is that $pagehit ends up as 0. and if I enclose
>  >> $current in '' in gives me a fixed number (2390) ?? .. don't get it
>  >> ... help anyone ??  I am failry new to perl and I did look through
>  >> the camel book but to no avail !!
>
>what is in $current and $logfile? have you verified they have good
>values? is $current a legal search pattern for grep? if not then you
>will get an error and you are not checking for that.

yep they print out fine ,, 
 I think the problem is the interpolation of the variable $current 
what is being stored in there right now is something like cns.html or
info.html 


>
>uri
>
>-- 
>Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
>uri@fastengines.com                                  http://www.fastengines.com

Steve


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

Date: 29 Sep 1998 18:14:47 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: steveg@nospam.org (Steve maZe)
Subject: Re: Need help with interpolation of a scalar !! ?
Message-Id: <sar1zouva5k.fsf@camel.fastserv.com>

>>>>> "Sm" == Steve maZe <steveg@nospam.org> writes:

  Sm>  29 Sep 1998 16:48:49 -0400, Uri Guttman <uri@camel.fastserv.com>
  Sm> wrote:

  >> use the Basename module or some other common method to get the filename
  >> from a path. forking a process to do it is a big waste of cpu time.

  Sm> didn't know one existed but I am learning
  Sm> I am assuming it's something like $current = basename($temp);

do a search on dejanews for basename to see some threads on using the
module and other builtin ways to do that. it's perl's motto, there is
more than one way to do it.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 29 Sep 1998 19:51:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Need method to round real number to two decimal places
Message-Id: <6urdn4$hi$1@client3.news.psi.net>

Roy Kenneth Scaife (rscaife@falcon.csc.calpoly.edu) wrote on MDCCCLV
September MCMXCIII in <URL:news:6ur6nu$rff$1@cscnews.csc.calpoly.edu>:
++ I am looking for a method of rounding a real number to two decimal places.
++ e.g. 3.534364 --> 3.53
++ 
++ Using printf is _not_ an option as   
++ the new value will then be used for further calculations.  


In that case, you need to use hardware that using decimal numbers
internally. Binary computers are not an option.

See the FAQ.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: 29 Sep 1998 17:12:51 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: new term for illogical
Message-Id: <saraf3ivd0s.fsf@camel.fastserv.com>


i just was writing to elaine (happy fun girl) about something and i
invented a new term. we might want to use in perl discussions.

i was saying how if i drink alcohol i get 'reese' as i lose my ability
to think logically.

so you can say that is really reese to use that perl idiom that way.

or that solution is very reese, try this one!

or this whole new term is reese (recursive usage).

:-)

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 29 Sep 1998 22:05:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: new term for illogical
Message-Id: <6urlii$37a$2@client3.news.psi.net>

Uri Guttman (uri@camel.fastserv.com) wrote on MDCCCLV September MCMXCIII
in <URL:news:saraf3ivd0s.fsf@camel.fastserv.com>:
++ 
++ i just was writing to elaine (happy fun girl) about something and i
++ invented a new term. we might want to use in perl discussions.
++ 
++ i was saying how if i drink alcohol i get 'reese' as i lose my ability
++ to think logically.


Can we then define "to uri" as "to forget how the shift key works"?



Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: 29 Sep 1998 18:17:40 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: abigail@fnx.com
Subject: Re: new term for illogical
Message-Id: <saryar2tvgb.fsf@camel.fastserv.com>

>>>>> "A" == Abigail  <abigail@fnx.com> writes:

  A> Uri Guttman (uri@camel.fastserv.com) wrote on MDCCCLV September MCMXCIII
  A> in <URL:news:saraf3ivd0s.fsf@camel.fastserv.com>:
  A> ++ 
  A> ++ i just was writing to elaine (happy fun girl) about something and i
  A> ++ invented a new term. we might want to use in perl discussions.
  A> ++ 
  A> ++ i was saying how if i drink alcohol i get 'reese' as i lose my ability
  A> ++ to think logically.


  A> Can we then define "to uri" as "to forget how the shift key works"?

dear abby,

i didn't know you cared! i feel the love pouring from you. i would be
honored to have that named for me even though i didn't invent this style
on usenet or email. i just liked it.

print ucfirst( 'uri' ) ;

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Tue, 29 Sep 1998 22:29:33 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: new term for illogical
Message-Id: <36115CDB.15E38D59@bbnplanet.com>

Uri Guttman wrote:

HappyFunBall! not girl. grrrr. Do not taunt.

> i was saying how if i drink alcohol i get 'reese' as i lose my ability
> to think logically.

I can picture it now....Uri running down the hall screaming 'I've just
been drive-by reeeessssseeeeeddddd!!!!!'. The white coats can't be far
behind :)

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


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

Date: Tue, 29 Sep 1998 22:31:12 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: new term for illogical
Message-Id: <36115D3E.5A0F487E@bbnplanet.com>

Abigail wrote:

> Can we then define "to uri" as "to forget how the shift key works"?

Hmm...'to abigail'...what could that possibly be? *giggle* 'to uri' has
a nice ring to it. 

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


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

Date: Tue, 29 Sep 1998 17:44:18 -0400
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: OO: How to make "dual" natured package
Message-Id: <joe.mcmahon-2909981744180001@prtims.stx.com>

In article
<ptru31wp9gh.fsf@olkikukka.i-have-a-misconfigured-system-so-shoot-me>,
jari.aalto@poboxes.com (Jari Aalto+mail.perl) wrote:


>        Also I tried my first OO, piece but I can't see an obvious
>        mistake here. Would you give me a hand?
>
>        jari
>
>package Class;
>
>sub new   { bless {}, $shift  }
This routine gets the classname followed by the parameters, and must return
the object you created. You bless an object into no class, and return the
classname.

>sub hello { shift; print @ARG }
You are printing the value of the nonexistent array @ARG. @_ has the
arguments to a subroutine.
>
>package main;
>
>$obj = new Class;
>$obj->hello( "world" );
>
>--> Can't locate object method "hello" via package "main" 

package Class;
sub new {
    # Get class
    my $class = shift;
    # bless new object into that class
    bless {},$class;
    # automagically returns object because result of bless is the
    # blessed reference; last expression evaluated is return value
}

sub hello {
   # save reference to object (though it isn't used)
   my $self = shift;
   # print everything else
   print @_;
}

 --- Joe M.


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

Date: Tue, 29 Sep 1998 18:18:48 -0400
From: "Alexander Kabaev" <akabaev@prodigy.com>
Subject: Re: Perl and ODBC?
Message-Id: <6urmau$nru$1@newssvr04-int.news.prodigy.com>

DBI interface with DBD::ODBC works perfectly for me.

David J. Topper wrote in message <360BF7CC.D1A9DDE6@virginia.edu>...
>Hello there,
>
>I'm trying to convince my boss to use perl instead of cold fusion.  The
>snags are:
>
>a)  he needs to use NT (ok ... there is perl for NT)
>b)  he wants to talk with an MS Access database (preferrably with ODBC)
>
>I've heard there are other mechanisms for talking with MS Access, but he
>seems to really want ODBC stuff.  I don't even know what the hell the
>difference is. We used to use sybperl back at Time Inc., then later some
>special functions that opened connections with a Sybase database.
>
>Any input would be appreciated.
>
>Thanks,
>
>Dave Topper
>--
>Technical Director, Virginia Center for Computer Music
>Programmer / Analyst, Dean's Office (School of A&S)
>http://www.panix.com/~topper
>(804) 924-6887




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

Date: 29 Sep 1998 14:19:02 -0800
From: "Deborah Murray" <dmurray@dgesolutions.com>
Subject: Perl Training
Message-Id: <01bdd9d9$f1e41830$dd98c9d0@debhome>


Accelerated Perl Programming Training
presented by the UniForum Technology Training Institute
December 16-17, 1998
San Francisco, CA
For more information, visit the Web @
http://www.uniforum.org/web/education/perlworkshop.html
or call 1-800-333-8649.




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

Date: Tue, 29 Sep 1998 18:25:23 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl Training
Message-Id: <comdog-ya02408000R2909981825230001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bdd9d9$f1e41830$dd98c9d0@debhome>, "Deborah Murray" <dmurray@dgesolutions.com> posted:

>Accelerated Perl Programming Training
>presented by the UniForum Technology Training Institute

>http://www.uniforum.org/web/education/perlworkshop.html

404 Not Found

The requested URL /web/education/perlworkshop.html was not found on this server. 



btw, i have a Perl script which can help you find other stale links
on your server.  if you wanted to add a web form to the real URL,
<URL:http://www.uniforum.org/web/education/advperl.html>, perhaps you
can take one of my CGI courses. ;)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>


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

Date: Tue, 29 Sep 1998 12:49:15 -0800
From: Fred_Gurzeler@rand.org (Fred Gurzeler)
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <Fred_Gurzeler-2909981249160001@gurzeler.rand.org>

Crash and burn.  Is there any other way?

Fred


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

Date: Tue, 29 Sep 1998 21:52:17 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <6urkqh$7re$1@nnrp1.dejanews.com>

In article <36111194.13B6ECD7@min.net>,
  John Porter <jdporter@min.net> wrote:
> I get notifications of CPAN updates via rye bread.
[snip]
> I usally use rye with caraway, since that seems to automatically
> install any modules which have changed.

I have never experienced this, but I have heard similar claims
in regard to pumpernickel. If true, regular rye would definitely be an
improvement ... all of the CPAN of pumpernickel, without any of
the flatulence.

Patrick Timmins
$monger{Omaha}[0]

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Tue, 29 Sep 1998 16:16:59 -0500
From: Ernest Mueller <ernestm@towery.com>
Subject: Problem Joining Lines in Delimited Data - Solution
Message-Id: <36114E4B.F8E99837@towery.com>

I was trying to solve a problem likely common to those exporting data
from Access or other such Microsofty sources containing text fields -
that if there are hard returns in such fields, exporting to text gives
you "broken" lines, like:

a:b:c (whole line)
hi mom:i like
ham:do you? (broken line)

And you want the broken line fixed to be:
hi mom:i like ham:do you?

Thanks to the posters and mailers that helped me avoid a messy
regexp-based solution!  Here's my final script for anyone that might
find it handy...

#!/usr/bin/perl
$numfields = 20;
open (FILE, "< dataraw.txt");
open (NEWFILE, "> datacooked.txt");
$record='';
while(<FILE>){
    chomp;
    $record.=$_;
    if($record=~tr/\t// >= ($numfields - 1)){
        $record=~s/\n/ /g;
        print NEWFILE $record,"\n";
        $record='' }
    else{
        $record.=" "; }
}
close FILE;
close NEWFILE;   
exit 0;

Ernest              
-- 
Ernest C. Mueller                               ernestm@towery.com
Vice President for Technical Development        Phone: (901) 251-7000
Towery Publishing                               http://www.towery.com


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

Date: 29 Sep 1998 19:58:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: regex problem
Message-Id: <6ure5n$hi$3@client3.news.psi.net>

cristiana@my-dejanews.com (cristiana@my-dejanews.com) wrote on MDCCCLV
September MCMXCIII in <URL:news:6uqtq7$arq$1@nnrp1.dejanews.com>:
++ I was writing a perl script and i used the regex $value=~s/\s*$//g and when
++ perl (5.00502) got to that line it gave me a core dump, but when i changed it
++ to $value=~s/\s+$//g it worked fine.  Does anyone know why the first regex
++ died? cristiana


I'm unable to reproduce the problem, but a core dump is a bug in Perl.
Please use "perlbug" to report this problem.

As for s/\s*$//g, you probably want $value =~ s/\s+$//;




Abigail
-- 
undef$/;$_=<DATA>;s.\n..g,%%=map{$i++=>$_}split//=>"Y|\\<>/,";s,9(..)|8(
 .)|7(.),($1||$2?" ":_)x($1||$2||$3||10),xeg,s,.,$%{$&}||$&,xeg,s,(.{54})
,$1\n,xg,print
__DATA__
915749177293018418172817282775821719281841182182258273528372292352721841
182182527381282182192527811745574824811721946259467284729217585748474817
158217181182172847481778227282283584282582718122837221821822817158172812
271827281282581728127118318223823714814182182183082228273582182125813748
251731825812745811721821731825812738248117218825862592025862591970917729
252768328274817781182192518573571581728122718272812182192518418428273582
182125182172923174185273824811721821745938259327381739197292558318328175
857482182181728274817786589227282282715817328118215815715817281227182728
128528408458158172812712822738118438128273582182125862731718258137482581
2738241721718128127382481172191425872586258625852589


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

Date: Tue, 29 Sep 1998 22:30:57 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Segmentation Fault with Perl5.00404 on Linux 2.0.35
Message-Id: <slrn712rkl.4h.alastair@calliope.demon.co.uk>

Jerry Henderson <jxh@mail.umb.com> wrote:
>
>I can't even do a  Perl -v without getting a segmentation fault.
>So it appears that Perl is not getting out of the starting blocks.

If 'perl -v' doesn't work then you should probably ask the sysadmin why not.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Tue, 29 Sep 1998 08:18:50 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: Unix & Perl Newbie Questions
Message-Id: <3610DE3A.977A29B5@email.sps.mot.com>

Craig Berry wrote:
> Typically, you'd use a Windows programming-oriented text editor (e.g.,
> Emacs, PFE, BBEdit) to write the code, then run it in a DOS box from the
> command line.

I know this has nothing to do with Perl, but BBEdit on Win32!? Where can
I find a copy? A web search only showed BBEdit on Mac.


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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