[16770] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4182 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 30 18:20:49 2000

Date: Wed, 30 Aug 2000 15:20:31 -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: <967674030-v9-i4182@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 30 Aug 2000     Volume: 9 Number: 4182

Today's topics:
    Re: Partner Required. Perl Programmer <Rob@barbados.cc>
    Re: Partner Required. Perl Programmer <care227@attglobal.net>
    Re: Partner Required. Perl Programmer <peckert@epicrealm.com>
    Re: Partner Required. Perl Programmer <uri@sysarch.com>
    Re: Partner Required. Perl Programmer <godzilla@stomp.stomp.tokyo>
    Re: Partner Required. Perl Programmer <uri@sysarch.com>
    Re: Partner Required. Perl Programmer <lauren_smith13@hotmail.com>
    Re: Partner Required. Perl Programmer <uri@sysarch.com>
    Re: Partner Required. Perl Programmer (Tony L. Svanstrom)
    Re: Partner Required. Perl Programmer (brian d foy)
        pattern matching question (in plain ASCII) <bruno.pagis@usa.alcatel.com>
    Re: pattern matching question (in plain ASCII) <lauren_smith13@hotmail.com>
    Re: pattern matching question (in plain ASCII) <lr@hpl.hp.com>
    Re: perl prob. <lr@hpl.hp.com>
    Re: processing files in a directory and stuff <gorbeast@SPAMSUCKS.subduction.org>
    Re: quickie obfuscation... (Mark-Jason Dominus)
    Re: quickie obfuscation... <tina@streetmail.com>
    Re: quickie obfuscation... (Mark-Jason Dominus)
        Removing portions of arrays. johnvert@my-deja.com
    Re: Removing portions of arrays. <tim@ipac.caltech.edu>
    Re: Removing portions of arrays. (Tim)
    Re: Searching for SQL statements <gellyfish@gellyfish.com>
    Re: Searching for SQL statements <jeff@vpservices.com>
    Re: Starting another CGI fram a running CGI <tina@streetmail.com>
    Re: Starting another CGI fram a running CGI <jevon@islandtelecom.com>
    Re: The Hacker signature disciplin (Jakob Schmidt)
        timelocal() is wrong? <jjk@onlink.net>
    Re: TMTOWTDI - but how best to do this ?? <abe@ztreet.demon.nl>
    Re: Trouble Reading From Database File... <lr@hpl.hp.com>
    Re: Trouble setting arrays and hashes in namespace $thi <abe@ztreet.demon.nl>
        Unsuccessful stat on filename error lishy1950@my-deja.com
    Re: Unsuccessful stat on filename error <lauren_smith13@hotmail.com>
    Re: Unsuccessful stat on filename error (Jan VAN ELDIK)
    Re: Unsuccessful stat on filename error lishy1950@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 30 Aug 2000 18:14:17 GMT
From: Rob <Rob@barbados.cc>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <39AD4E9E.CA059DC8@barbados.cc>

Sorry uRi.
Your are not qualified enough.
A "relaxed easy going attitude" is a key requirement.






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

Date: Wed, 30 Aug 2000 14:31:01 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <39AD52E5.576AEA66@attglobal.net>

Rob wrote:
> 
> Sorry uRi.
> Your are not qualified enough.

Thats pretty funny.


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

Date: Wed, 30 Aug 2000 18:35:39 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <39AD541F.FA4C3003@epicrealm.com>


Rob wrote:
> 
> Sorry uRi.
> Your are not qualified enough.
> A "relaxed easy going attitude" is a key requirement.

Did you catch that, Uri?  Not only do they want to offer nothing, but
they don't want you to complain, either.  This is sure a good deal for
somebody :).  Maybe the troll?

Rob, try emailing your request to: callgirl@la.znet.com 

And, reiterating:  This is off-topic here.

Paul 
peckert@epicrealm.com


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

Date: Wed, 30 Aug 2000 19:14:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <x7k8cyr27w.fsf@home.sysarch.com>

>>>>> "PE" == Paul Eckert <peckert@epicrealm.com> writes:

  PE> Rob wrote:
  >> 
  >> Sorry uRi.
  >> Your are not qualified enough.
  >> A "relaxed easy going attitude" is a key requirement.

  PE> Did you catch that, Uri?  Not only do they want to offer nothing, but
  PE> they don't want you to complain, either.  This is sure a good deal for
  PE> somebody :).  Maybe the troll?

damn, i am pissed off!! i am so upset that i can't get this job. i have
some much sweat to offer. i would sweat gallons for this place (and make
rob drink it all).

  PE> Rob, try emailing your request to: callgirl@la.znet.com 

heh. her contributions would make the equity worthless.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 30 Aug 2000 12:51:57 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <39AD65DD.F9A232DA@stomp.stomp.tokyo>

Paul Eckert wrote:
 
> Rob wrote:

> Rob, try emailing your request to: callgirl@la.znet.com

This is good advice. I am the only around here
who knows more than diddly squat about Perl
programming, as you and all well know.

Look at that! Took me less than ten minutes
to hack Mozilla 4.75 to make it do what I
wish. I should visit Mountain View and
offer my services, for a pretty penny.

Godzilla!

-- 
Perl Monger's Perfect Perl Perl Land.
  http://la.znet.com/~callgirl/perlperl.cgi


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

Date: Wed, 30 Aug 2000 20:14:05 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <x7hf82qzg2.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> Look at that! Took me less than ten minutes
  G> to hack Mozilla 4.75 to make it do what I
  G> wish. I should visit Mountain View and
  G> offer my services, for a pretty penny.

oh, please offer yourself unto the silly valley and leave this
newsgroup. they will appreciate your callgirl services and pay you
plenty. in particular apply to work for redmond. they will love you.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 30 Aug 2000 13:17:21 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <8ojq0o$9kj$1@brokaw.wa.com>


Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:39AD65DD.F9A232DA@stomp.stomp.tokyo...
> I should visit Mountain View and
> offer my services, for a pretty penny.
>

I think you missed the part of the thread where Rob was refusing to pay.
Mountain View's a nice town to visit once in a while and it's close enough
to San Francisco so the trip wouldn't necessarily be wasted.

Lauren
--
print grep ord $_,map{y/a-zA-Z//d;$x.="+ $_";chr(eval $x)}
'J74u43-s2tA1-84n33o45th1er5-12-P3e13-82r48l21H13-a6-76
c40k25er2wx8-y6z13-81'=~m#([^!\n]{3})#g#tr/-0-9//d;print






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

Date: Wed, 30 Aug 2000 20:30:17 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <x7em36qyp2.fsf@home.sysarch.com>

>>>>> "LS" == Lauren Smith <lauren_smith13@hotmail.com> writes:

  LS> Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
  LS> news:39AD65DD.F9A232DA@stomp.stomp.tokyo...
  >> I should visit Mountain View and
  >> offer my services, for a pretty penny.
  >> 

  LS> I think you missed the part of the thread where Rob was refusing
  LS> to pay.  Mountain View's a nice town to visit once in a while and
  LS> it's close enough to San Francisco so the trip wouldn't
  LS> necessarily be wasted.

just showing off her typical lack of reading comprehension.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 30 Aug 2000 22:36:02 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Partner Required. Perl Programmer
Message-Id: <1eg782e.15ncfx2v51zyxN%tony@svanstrom.com>

Uri Guttman <uri@sysarch.com> wrote:

> >>>>> "R" == Rob  <Rob@barbados.cc> writes:
> 
>   R> From: cgi.resourceindex.com
>   R> Description:
>   R>                                 Partner needed to continue and complete
>                                      why would anyone
>   R> a DB based site with
> work for someone
>   R>                                 large potential. Project is half done
>                                      who can't be bothered
>   R> and previous Partner has
> to wrap his post correctly
>   R>                                 too much work from his other business to
>   R> complete this one.
>   R>                                 Arrangement is "sweat equity" 50%
>                                      and who offers sweat equity in
> something which is
>   R> ownership for your programming
>   R>                                 input. All other expenses, and work
>                                      not described in any way
>   R> covered by other Partner.
> shape or form.
>   R> Requirements:
>   R>                                 Here are a few things we were working
>                                      owning 50% of vaporware
>   R> with: Apache with mod_perl
> is still nothing.
>   R>                                 An SQL database the latest perl DBI
>                                      i will now wait
>   R> module the latest perl DBD
> for the dhabot to kick in (hi dha!)
>   R>                                 module to match the SQL database the
>   R> latest perl CGI module Perl
>   R>                                 5.005_02 or newer.
> 
> uri

Thanks a lot, Uri, you just gave me a headache. *LOL*


     /Tony... sorry for the noice...
-- 
     /\___/\ 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: Wed, 30 Aug 2000 16:42:52 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Partner Required. Perl Programmer
Message-Id: <brian-ya02408000R3008001642520001@news.panix.com>

In article <x7hf82qzg2.fsf@home.sysarch.com>, Uri Guttman <uri@sysarch.com> posted:

> >>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:
> 
>   G> Look at that! Took me less than ten minutes
>   G> to hack Mozilla 4.75 to make it do what I
>   G> wish. I should visit Mountain View and
>   G> offer my services, for a pretty penny.
> 
> oh, please offer yourself unto the silly valley 

don't you mean Reston, VA now?  home of the CDC? ;)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Wed, 30 Aug 2000 18:45:15 GMT
From: Bruno Pagis <bruno.pagis@usa.alcatel.com>
Subject: pattern matching question (in plain ASCII)
Message-Id: <20000830.18451580@FA918059.aur.alcatel.com>

Hi,
I'd like to extract anything between </td> and <a href in a string. I=20=

simply don't know how to say "take anything until you find <a href" when=
=20
I=20
describe the pattern:
$text =3D~ s#</td>(.*)<a href#$1#			# doesn't work because .* will match=
=20
anything
$text =3D~ s#</td>(.*(?=3D<a href))<a href#$1#	# will not work either :-=
(

I have a way to say [^<] to exclude a character, but what I miss is a wa=
y=20
to exclude a string, something like [^(<a href)]. See what I mean ?
Or maybe I cannot do it this way. But then, how?
Your help welcome. Thanks. BRUNO.



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

Date: Wed, 30 Aug 2000 12:16:23 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: pattern matching question (in plain ASCII)
Message-Id: <8ojmef$7ni$1@brokaw.wa.com>

(OT - Why didn't Outlook express add indentation to this message?)

Bruno Pagis <bruno.pagis@usa.alcatel.com> wrote in message
news:20000830.18451580@FA918059.aur.alcatel.com...
> Hi,
> I'd like to extract anything between </td> and <a href in a string. I
> simply don't know how to say "take anything until you find <a href" when
> I
> describe the pattern:
> $text =~ s#</td>(.*)<a href#$1# # doesn't work because .* will match
> anything
> $text =~ s#</td>(.*(?=<a href))<a href#$1# # will not work either :-(

> I have a way to say [^<] to exclude a character, but what I miss is a way
> to exclude a string, something like [^(<a href)]. See what I mean ?
> Or maybe I cannot do it this way. But then, how?

You can do it with:

$text =~ s#</td>(.*?)<a href#$1#;

but that will only catch the first occurence of '</td>...<a href>', and it
will obliterate the rest of $text.  Maybe you want that, I don't know.

If you are going to be doing parsing of HTML, you're better off using
HTML::Parser or some such module which has been designed for parsing HTML.

For simplicity's sake, here's a solution(?) that will capture all occurences
of data between '</td>' and '<a href':

@data = $text =~ m#</td>(.*?)<a href#g;

If you are interested in regular expressions, see the perlre documentation.
There's a ton of interesting information to chew on in there.

Lauren
--
print grep ord $_,map{y/a-zA-Z//d;$x.="+ $_";chr(eval $x)}
'J74u43-s2tA1-84n33o45th1er5-12-P3e13-82r48l21H13-a6-76
c40k25er2wx8-y6z13-81'=~m#([^!\n]{3})#g#tr/-0-9//d;print






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

Date: Wed, 30 Aug 2000 12:27:26 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: pattern matching question (in plain ASCII)
Message-Id: <MPG.1416fffa7d7680fc98ad03@nntp.hpl.hp.com>

[Not quite 'plain ASCII':

Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

But it certainly is more legible.]

In article <20000830.18451580@FA918059.aur.alcatel.com> on Wed, 30 Aug 
2000 18:45:15 GMT, Bruno Pagis <bruno.pagis@usa.alcatel.com> says...
> Hi,
> I'd like to extract anything between </td> and <a href in a string. I=20=
> 
> simply don't know how to say "take anything until you find <a href" when=
> =20
> I=20
> describe the pattern:
> $text =3D~ s#</td>(.*)<a href#$1#			# doesn't work because .* will match=
> =20
> anything
> $text =3D~ s#</td>(.*(?=3D<a href))<a href#$1#	# will not work either :-=
> (
> 
> I have a way to say [^<] to exclude a character, but what I miss is a wa=
> y=20
> to exclude a string, something like [^(<a href)]. See what I mean ?
> Or maybe I cannot do it this way. But then, how?
> Your help welcome. Thanks. BRUNO.

Do you want to extract a substring (as you say) or change a string (as 
your code tries to do)?  I will assume extraction.

In either case, you want non-greedy case-insensitive line-spanning 
matching.

  $text =~ m#</td>(.*?)(?=<a href)#is and print "$1\n";

For details:

  perldoc perlre

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


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

Date: Wed, 30 Aug 2000 11:16:34 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: perl prob.
Message-Id: <MPG.1416ef5f2715449b98ad01@nntp.hpl.hp.com>

In article <39AC211E.71DA2001@byu.edu> on Tue, 29 Aug 2000 14:46:22 -
0600, desi <desi@byu.edu> says...
> I am trying to find if the substring $items1 (a value I get from the
> text box of a form) exists in the string $data[i](0<=i<15). data is an
> array which has the item name and a price list as each element of the
> array.
> [FYI: I am doing this in Perl5]
> 
> for ($i=0;$i<15;$i++)
>   {  if ($data[$i] =~ m/$items1/)
>      { print "match ".$items1;

Isn't printing this once enough?  Use 'last' to break out of the loop.

>      }
>   }
> 
> Please let me know what is wrong with this or is there any alternate way
> to do this.

Looking for a substring match using a regex (especially one provided by 
a user!) is not as smart nor as safe nor as fast as using the index() 
function.

Assuming you pulled '15' from a hat without regard to the actual size of 
@data:

  for (@data[0 .. (@data < 15 ? $#data : 14)]) {
      next unless 0 <= index $_, $items1;
      print "match $items1";
      last;
  }

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


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

Date: Wed, 30 Aug 2000 13:45:13 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: Re: processing files in a directory and stuff
Message-Id: <39AD7259.1E1697A4@SPAMSUCKS.subduction.org>

Abe Timmerman wrote:
> 
> In view of what Eric Bohlman already wrote, lots of style issues (in an
> attempt to encourage you :-)

Thanks to Abe & Eric for the practical advice.  While I think that style
and efficiency and stuff is really important esp. on production machines
and scripts that others have to look at it, I am such a newbie that I am
overjoyed when the damn thing merely executes without error :)  That
being said,  your words are definitely not falling on deaf ears;
hopefully as time goes on I will be able to utilize proper style and
such in a more systematic manner. --G


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

Date: Wed, 30 Aug 2000 18:08:11 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: quickie obfuscation...
Message-Id: <39ad4d8a.1bdd$31b@news.op.net>


In article <8ofd95$apk9q$2@ID-24002.news.cis.dfn.de>,
Tina Mueller  <news@tinita.de> wrote:
>> || >\\ >           print 1 and 0;
>
>> If "print 1 and 0" is the final statement of a sub, there's a huge 
>> difference between "print 1 and 0" and "print (1) and '???'". As
>> large as false and true.
>
>of course. but in the above example "print 1 and 0" the "0"
>is just useless, because it's an unused constant value.

No, it isn't.  

        print 1 and 0

should yield a false value.

        print 1 and 137

should yield a true value.

There's something funky going on here because the 0 is optimized away
and replaced by a null node that somehow yields 0.

>the meaning of '???' is quite clearly explained in
>perldoc B::Deparse

It says that '???' indicates a value that was optimized away.  It does
not say that '???' indicates a useless or unused constant value.  Here
the value is not useless at all, and yet it's optimizaed away, and yet
Perl gets the right answer anyway through some hack.



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

Date: 30 Aug 2000 21:10:37 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: quickie obfuscation...
Message-Id: <8ojt8d$b26u5$2@ID-24002.news.cis.dfn.de>

hi,
Mark-Jason Dominus <mjd@plover.com> wrote:

> In article <8ofd95$apk9q$2@ID-24002.news.cis.dfn.de>,
> Tina Mueller  <news@tinita.de> wrote:
>>> || >\\ >           print 1 and 0;
>>
>>> If "print 1 and 0" is the final statement of a sub, there's a huge 
>>> difference between "print 1 and 0" and "print (1) and '???'". As
>>> large as false and true.
>>
>>of course. but in the above example "print 1 and 0" the "0"
>>is just useless, because it's an unused constant value.

> No, it isn't.  
>         print 1 and 0
> should yield a false value.
>         print 1 and 137
> should yield a true value.

well, I think it is useless. it is as useless as in
print 1;
0;
only in another context it could be used, for example in a
subroutine.
so, as I said before, in
sub test{print 1 and 0} it's of course not useless.
but if you give the deparser one line where you do
nothing than "print 1 and 0" then perl assumes
that 0 isn't used any more.
if you think it isn't useless what exactly can the 0 do
to the program?
or maybe better question, if it's not useless, then it
would change something if we'd replace it with a 1 (or 2, ...)?

> There's something funky going on here because the 0 is optimized away
> and replaced by a null node that somehow yields 0.

>>the meaning of '???' is quite clearly explained in
>>perldoc B::Deparse

> It says that '???' indicates a value that was optimized away.  It does
> not say that '???' indicates a useless or unused constant value.  Here
> the value is not useless at all, and yet it's optimizaed away, and yet
> Perl gets the right answer anyway through some hack.

what does 'optimized away' mean, then? perl knows that
this value will never be used, so it gets optimized
away, which is just displayed with '???' as a hint
for the user. (of course the string '???' would be true.)

what do you mean with "Perl gets the right answer through some hack"?
which right answer?

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Wed, 30 Aug 2000 21:15:03 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: quickie obfuscation...
Message-Id: <39ad7957.239f$3c4@news.op.net>

In article <8ojt8d$b26u5$2@ID-24002.news.cis.dfn.de>,
Tina Mueller  <news@tinita.de> wrote:
>>>of course. but in the above example "print 1 and 0" the "0"
>>>is just useless, because it's an unused constant value.
>
>> No, it isn't.  
>
>well, I think it is useless. 

You're right.  I misunderstood what was going on.


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

Date: Wed, 30 Aug 2000 18:26:09 GMT
From: johnvert@my-deja.com
Subject: Removing portions of arrays.
Message-Id: <8ojjj6$vpd$1@nnrp1.deja.com>

Hello,

I want to remove portions of text which are scattered line by line over
a certain array.  For example, if I have a file containing:

one
two
three
four
five

After it has been read into an array, I would want to remove all the
lines between `one' and `four'.  I wanted to do this using the range
operator (..), so I tried it first with a single string to see if it
works, and not with an array:

my $str="onefoobar";
$str=~s/n .. f//;    # attempt to remove n through f

but that didn't work.  The only way I could get it to work for a single
string was:

$str=~s/n.+?f//;

I want to apply this to a whole array, but I have no idea how.  I'm
pretty sure I saw this done with the range operator somewhere, but I
can't find that example again..

Hope this made some sense..

Thanks a lot,
  -- john
#define I        Just
#define a        Perl
#define Python   newbie
#define Hacker   "\n"
#define but      "\n"
#define saw      "\n"
#define the      "\n"
#define light    "\n"
#define was      another
#define Godzilla Lame

$s  = I    . ' ' . was  .  ' ' .  a    .  ' '  .  Python  . ' ' . Hacker
 .
      but  . ' ' . saw  .  ' ' .  the  .  ' '  .  light;
$s=~s/\n//g;$s=~s/\|//g;
print $s."\n";



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


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

Date: Wed, 30 Aug 2000 13:18:21 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Removing portions of arrays.
Message-Id: <39AD6C0D.9643B4C4@ipac.caltech.edu>

johnvert@my-deja.com wrote:
> I want to remove portions of text which are scattered line by line over
> a certain array.  For example, if I have a file containing:
> 
> one
> two
> three
> four
> five
> 
> After it has been read into an array, I would want to remove all the
> lines between `one' and `four'.

Look at perlop and understand how the '..' range operator actually works;
there're examples which you can lift almost exactly. Also read perlre again and
see that '/a .. b/' has *nothing* to do with the range operator.

perl -wne 'print if /^one/../^four/' test-file

--

-- Tim Conrow         tim@ipac.caltech.edu       626-395-8435


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

Date: Wed, 30 Aug 2000 20:07:41 GMT
From: SPAM+indigo@dimensional.com (Tim)
Subject: Re: Removing portions of arrays.
Message-Id: <8FA098F17indigodimcom@166.93.207.145>

johnvert@my-deja.com wrote in <8ojjj6$vpd$1@nnrp1.deja.com>:

>Hello,
>
>I want to remove portions of text which are scattered line by line over
>a certain array.  For example, if I have a file containing:
>
>one
>two
>three
>four
>five
>
>After it has been read into an array, I would want to remove all the
>lines between `one' and `four'.  I wanted to do this using the range
>operator (..), so I tried it first with a single string to see if it
>works, and not with an array:
>
>my $str="onefoobar";
>$str=~s/n .. f//;    # attempt to remove n through f

>but that didn't work.  The only way I could get it to work for a single
>string was:
>
>$str=~s/n.+?f//;

Right.  .. does not work as a range operator in regex.  Nice try, though.

>I want to apply this to a whole array, but I have no idea how.  I'm
>pretty sure I saw this done with the range operator somewhere, but I
>can't find that example again..

Ahhh, the dreaded bistable range operator...:)

    my @array = qw(zero one two three four five);
    my @new = grep {/one/ .. /four/} @array;
    print join('|', @new) . "\n";

one|two|three|four

EXPR1 .. EXPR2 starts out false, become true when EXPR1 is true,
and remains true until after EXPR2 becomes true.

One of the more obscure commands.  man perlop for more info.

-T


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

Date: 29 Aug 2000 21:21:08 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Searching for SQL statements
Message-Id: <8oh5vk$r1h$1@orpheus.gellyfish.com>

On Tue, 29 Aug 2000 17:36:59 GMT Philip Taylor wrote:
> I'm trying to analyse a large number of Ingres OpenROAD program source
> files for SQL statements to produce information such as number of
> SELECTS/INSERTS etc and which tables are used. I have several hundred
> program export files to analyse.
> 
> I wondered if there are any  Perl facilities that can identify SQL
> statements in a source file? 

I'm not sure what OpenROAD source looks like but at a guess I would say
that it is much like Informix 4GL (and similar ) in that it has programming
constructs with arbitrary bits of SQL thrown in both standalone and in
strings for prepared statements and the like.  You are almost certainly
on your own in parsing the SQL statements from the rest of the language
constructs but once you have done that you might well be able to use the
module SQL::Statement to parse the SQL and gain information about it. If
your source is fairly consistent you might well be able to get away with
something like :

   @statements = $source =~ /(select .+?;)/isg;

where $source contains the entire source of your program - however I very
much doubt it as things are rarely as simple as that .

Maybe you could post the teensiest piece of code that characterizes the
kind of stuff you are looking at.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Wed, 30 Aug 2000 13:53:57 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Searching for SQL statements
Message-Id: <39AD7465.241D6E88@vpservices.com>

Jonathan Stowe wrote:
> 
> On Tue, 29 Aug 2000 17:36:59 GMT Philip Taylor wrote:
> > I'm trying to analyse a large number of Ingres OpenROAD program source
> > files for SQL statements to produce information such as number of
> > SELECTS/INSERTS etc and which tables are used. I have several hundred
> > program export files to analyse.
> >
> > I wondered if there are any  Perl facilities that can identify SQL
> > statements in a source file?
> 
> I'm not sure what OpenROAD source looks like but at a guess I would say
> that it is much like Informix 4GL (and similar ) in that it has programming
> constructs with arbitrary bits of SQL thrown in both standalone and in
> strings for prepared statements and the like.  You are almost certainly
> on your own in parsing the SQL statements from the rest of the language
> constructs 

Right, that will be the first thing to tackle, parsing out what is SQL
from what isn't.

> but once you have done that you might well be able to use the
> module SQL::Statement to parse the SQL and gain information about it.

That module currently only supports a very limited subset of SQL.  In
particular, you would have problems with joins, sub-selects, etc.  I am
re-writing the module using Parse::RecDescent but it will be a while
before it is done.  Feel free to write if a pre-alpha would be useful to
you.

-- 
Jeff


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

Date: 30 Aug 2000 20:26:32 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <8ojqlo$b26u5$1@ID-24002.news.cis.dfn.de>

hi,
"Martin Pl=FCcker" <mail@maple-soft.de> wrote:
> There is still one littel question left.

http://learn.to/quote (only in german)

> How can a give b some parameters with the exec function?

as you would do on the command line.
program a b c
then they are in @ARGV

tina


--=20
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Wed, 30 Aug 2000 20:35:27 GMT
From: "Jevon MacDonald" <jevon@islandtelecom.com>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <jeer5.68$KJ3.35079@sapphire.mtt.net>

Fork it out.


"Martin Plücker" <mail@MAPLe-Soft.de> wrote in message
news:8oj8ip$4km$11$1@news.t-online.com...
> Hi!
>
> I have a little prblem and I hope some of you can help me. So here it is:
>
> Ich have two CGIs a and b. CGI a is called by a browser. Then a schould
> start b, a CGI that takes very long to finish, with some parameters. a
> should then run on normally, not caring about b in any way, and return
> something to the refering browser.
> The problem is that with system() CGI a waits for b to finish and return.
> But b takes very long (about an hour) and the refering user should see
some
> message immediately.
>
> Is there any way to solve this problem and to run b completely dissociated
> from a? Example code?
>
> Thaks
> Martin
>
>




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

Date: Wed, 30 Aug 2000 22:27:19 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: The Hacker signature disciplin
Message-Id: <1eg77e9.1v9a1rz1ggx3nkN@[192.168.88.117]>

jason <elephant@squirrelgroup.com> wrote:

> Jakob Schmidt <sumus@aut.dk> wrote ..
> 
> >print "I'm a loser baby\n";
> 
> lol .. you mean (in the style of one of Ilmari's examples)
> 
>   print @{{split//,qq.q\nf d l b'iscmeanaaIglkrhopyjembob.}}{a..q.q.};

man you guys are crazy :-D

-- 
Jakob


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

Date: Wed, 30 Aug 2000 15:59:45 -0400
From: "Jonah" <jjk@onlink.net>
Subject: timelocal() is wrong?
Message-Id: <8ojvo8$956$1@onlink3.onlink.net>

Why does this return a value?

my $seconds = timelocal(0, 0, 0, 31, 1, 100);

This is February 31st, 2000 and...
there's no such thing!

Shouldn't I be getting a -1 value, or some sort of
indication that this is an error?

 ...and get this, here are the values I get
from feb 29 - 951811200
to feb 31 (midnight) - 952070399

So does this mean that the seconds for March 1st are off?
It keeps adding seconds as if feb 30 and feb 31st count as days...

This means that by the time you get to, say, Dec 5th, the seconds are 8 days
ahead..
(one for each month that has no 31, and 2 in february)

Nevermind the fact that the seconds have been counted for 31 days for every
month
since the epoch.

I guess timelocal is all relative...but still...this is screwing with my
head now....

Can someone explain all of this? thanks




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

Date: Wed, 30 Aug 2000 21:21:45 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: TMTOWTDI - but how best to do this ??
Message-Id: <59lqqsc416vsfs1qj2t5i1h1g215tv2f4a@4ax.com>

On Wed, 30 Aug 2000 15:44:41 GMT, reg_exp@my-deja.com wrote:

> thanks for that Abe, however could you tell me what the => operator
> does in this line:
> $sum += $_ for map /(\d)/g => map { ($i++ % 2 + 1) * $_ } /(\d)/g;
> 
> i thought the => operator was used only for hashes.... i cant
> understand it's usage here, is it documented in the faqs ??

From the section "Comma Operator" in perlop:
  The => digraph is mostly just a synonym for the comma operator. It's
  useful for documenting arguments that come in pairs. As of release
  5.001, it also forces any word to the left of it to be interpreted as
  a string.

I use it for the 'map EXPR, LIST' and 'grep EXPR, LIST' forms of map()
and grep() as I think it stands out more than ','.

Now that I look at it, I realize it was too late when I wrote it:

	$sum += $_ for	map /(\d)/g => 
			map $_ * ($i++ % 2 + 1) => /(\d)/g;


-- 
Good luck,
Abe

##
perl -Mstrict -we 'sub Just{&$_}sub another{&$_}sub Perl{&$_}sub hacker{&$_}$_=sub{(split /::/,(caller $^W)[3])[-$^W]};print join " ", Just, another, Perl, hacker;'


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

Date: Wed, 30 Aug 2000 11:00:43 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Trouble Reading From Database File...
Message-Id: <MPG.1416eba7fb843e2998ad00@nntp.hpl.hp.com>

In article <slrn8qotlq.ra.mgjv@verbruggen.comdyn.com.au> on Wed, 30 Aug 
2000 03:52:03 GMT, Martien Verbruggen <mgjv@verbruggen.comdyn.com.au> 
says...

 ...

> while (my $line = <DATA>)
> {
> 	my ($username,$password) = split(/\|/, $line);
> 	if ($user_name eq $username)
> 	{
> 		login();
> 	} 
> 	else 
> 	{
> 		home();
> 	}
> }

Some like their coding vertical.  I prefer horizontal:

  (split /\|/)[0] eq $user_name ? login() : home() while <DATA>;

One can see a lot more code in a given screenful.  Assuming that's a 
Good Thing (TM).

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


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

Date: Wed, 30 Aug 2000 22:54:16 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Trouble setting arrays and hashes in namespace $this_namespace
Message-Id: <llrqqsoufnolqf10qatvjthsibfk62heun@4ax.com>

On Wed, 30 Aug 2000 09:41:12 -0700, "Matthew Fox" <superior@island.net>
wrote:
> ----- Original Message -----
> From: <nobull@mail.com>

 ...

>  $namespace = "NAME";
>  $i = 0;
> 
>  while ($glued_line = <FH>) { # GO THROUGH EACH LINE IN THE DATABASE
> 
> # $glued_line is one line out of a file and is in the format x)(x)(x\n
> 
>   chomp($glued_line); # GET RID OF NEWLINE AT END
> 
>    @record_fields = split(/\)\(/,$glued_line);
> 
>    ${"${namespace}::id_by_names{$record_fields[1]}"} = $record_fields[0];

	${"${namespace}::id_by_names"} {$record_fields[1]} =
					$record_fields[0];
> 
>   ${"${namespace}::db[$i]"} = [ @record_fields ];

	${"${namespace}::db"} [$i] = [ @record_fields ];

> 
>    ++$i; # AUTOINCREMENT $i
> 
>  } # END OF FILEHANDLE LOOP
> 
> 
> I was hoping that %NAME::id_by_names would be defined and that @NAME::db
> would be a multidimensional array.
> 
> 
> > [1] Obviously since this is a question about symbolic refs you'd need
> > to have a "no strict 'refs'" in there.

ad [1]: My testcode (for this answer) looks like this:

#!/usr/bin/perl -w
use strict;

{
	package NAME;
	use strict;
	use vars qw(%id_by_names @db);
	1;
}

my $namespace = "NAME";

{	no strict 'refs';
 	while ( <DATA> ) { #the format: x)(x)(x\n
		chomp;
		my @fields = split /\)\(/;
   		${"${namespace}::id_by_names"}{$fields[1]} = $fields[0];
		push @{"${namespace}::db"}, \@fields;
	}
}

print "\%${namespace}::id_by_names contains:\n",
	map "\t$_ => $NAME::id_by_names{$_}\n" =>
		sort keys %NAME::id_by_names;

print "\@${namespace}::db contains:\n",
	map "\t".join(';', @$_)."\n" => @NAME::db;

__DATA__
f 1.1)(f 1.2)(f 1.3
f 2.1)(f 2.2)(f 2.3
f 3.1)(f 3.2)(f 3.3

-- 
Good luck,
Abe

##
perl -wle '$_="rekcah lreP rehtona tsuJ";print$2while s/(.*)(.)/$1/g'


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

Date: Wed, 30 Aug 2000 18:36:13 GMT
From: lishy1950@my-deja.com
Subject: Unsuccessful stat on filename error
Message-Id: <8ojk6q$ii$1@nnrp1.deja.com>

Hi
I'm getting the following error:
Unsuccessful stat on filename containing newline at script.pl line ***

Here's the trouble part of the script:

foreach $i ( @BLAH_TMP1 ) {
                if ( -e $i ) { **this line causes the error
                        `cp $i $i.$DATE` ;
                        `cp -rp $i.$DATE $LOG_STORAGE` ;
                        `cat /dev/null > $i`;
                }
        }

The book suggests chop or chomp on the files in question.  The files
don't have blank lines.  is there any other way to get around this?

Thanks!



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


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

Date: Wed, 30 Aug 2000 11:57:50 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Unsuccessful stat on filename error
Message-Id: <8ojlbm$70n$1@brokaw.wa.com>


<lishy1950@my-deja.com> wrote in message news:8ojk6q$ii$1@nnrp1.deja.com...
> Hi
> I'm getting the following error:
> Unsuccessful stat on filename containing newline at script.pl line ***
>
> Here's the trouble part of the script:
>
> foreach $i ( @BLAH_TMP1 ) {
>                 if ( -e $i ) { **this line causes the error
>                         `cp $i $i.$DATE` ;
>                         `cp -rp $i.$DATE $LOG_STORAGE` ;
>                         `cat /dev/null > $i`;
>                 }
>         }
>
> The book suggests chop or chomp on the files in question.  The files
> don't have blank lines.  is there any other way to get around this?

You may not be able to see the "\n" at the end of the name, though.  chomp()
$i before you stat it.

Also, have you thought about using File::Copy instead of cp?  perldoc
File::Copy

Lauren
--
print grep ord $_,map{y/a-zA-Z//d;$x.="+ $_";chr(eval $x)}
'J74u43-s2tA1-84n33o45th1er5-12-P3e13-82r48l21H13-a6-76
c40k25er2wx8-y6z13-81'=~m#([^!\n]{3})#g#tr/-0-9//d;print





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

Date: 30 Aug 2000 19:14:12 GMT
From: vaneldik@pcdeni01.cern.ch (Jan VAN ELDIK)
Subject: Re: Unsuccessful stat on filename error
Message-Id: <8ojme4$d80$1@sunnews.cern.ch>


In article <8ojk6q$ii$1@nnrp1.deja.com>,
 lishy1950@my-deja.com writes:

|> I'm getting the following error:
|> Unsuccessful stat on filename containing newline at script.pl line ***
|> 
|> Here's the trouble part of the script:
|> 
|> foreach $i ( @BLAH_TMP1 ) {
|>                 if ( -e $i ) { **this line causes the error

I believe it's the filename that contains the newline:

 dxplus04 [274] perl -we '$tmp = "/tmp\n"; print "ok\n" if -e $tmp'
 Unsuccessful stat on filename containing newline at -e line 1.

 dxplus04 [275] perl -we '$tmp = "/tmp"; print "ok\n" if -e $tmp'
 ok

I suggest you check how you fill the @BLAH_TMP1 array.

              cheers, Jan
   
--

   Jan van Eldik

   email: Jan.van.Eldik@cern.ch  tel: +41 - 22 - 767 4024 


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

Date: Wed, 30 Aug 2000 20:10:52 GMT
From: lishy1950@my-deja.com
Subject: Re: Unsuccessful stat on filename error
Message-Id: <8ojpnn$7j4$1@nnrp1.deja.com>

In article <8ojlbm$70n$1@brokaw.wa.com>,
  "Lauren Smith" <lauren_smith13@hotmail.com> wrote:
>
> <lishy1950@my-deja.com> wrote in message
news:8ojk6q$ii$1@nnrp1.deja.com...
> > Hi
> > I'm getting the following error:
> > Unsuccessful stat on filename containing newline at script.pl line
***
> >
> > Here's the trouble part of the script:
> >
> > foreach $i ( @BLAH_TMP1 ) {
> >                 if ( -e $i ) { **this line causes the error
> >                         `cp $i $i.$DATE` ;
> >                         `cp -rp $i.$DATE $LOG_STORAGE` ;
> >                         `cat /dev/null > $i`;
> >                 }
> >         }
> >
> > The book suggests chop or chomp on the files in question.  The files
> > don't have blank lines.  is there any other way to get around this?
>
> You may not be able to see the "\n" at the end of the name, though.
chomp()
> $i before you stat it.
>
> Also, have you thought about using File::Copy instead of cp?  perldoc
> File::Copy
>
> Lauren
> --
>

That worked, Thanks!
I usually use the File::Copy, but I'm fixing someone else's script which
is long, so I didn't notice that.

Lish


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


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

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


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