[19296] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1491 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 10 18:11:06 2001

Date: Fri, 10 Aug 2001 15:10:23 -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: <997481423-v10-i1491@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 10 Aug 2001     Volume: 10 Number: 1491

Today's topics:
    Re: Perl 5.6 Pollute <eric@mizuhocap.com>
        Perl and Charts <mark.riehl@agilecommunications.com>
    Re: Perl and Charts (Steven M. O'Neill)
    Re: Perl and Charts (Steven M. O'Neill)
    Re: perldoc is like Greek to a beginner?? MSherrill@compuserve.com
    Re: perldoc is like Greek to a beginner?? (Abigail)
    Re: Poor man's HTML hidden field message digest?? <miscellaneousemail@yahoo.com>
    Re: Poor man's HTML hidden field message digest?? (Tad McClellan)
    Re: Poor man's HTML hidden field message digest?? <gnarinn@hotmail.com>
    Re: Poor man's HTML hidden field message digest?? <miscellaneousemail@yahoo.com>
    Re: Poor man's HTML hidden field message digest?? <Tassilo.Parseval@post.rwth-aachen.de>
        prob.. for each  (open, file) (Jerry Nezlick)
    Re: regex question... <brentdax1@earthlink.net>
    Re: regex question... <strawSPAM_BEGONEman@plexi.com>
    Re: regex question... <ren@tivoli.com>
    Re: regex question... <strawSPAM_BEGONEman@plexi.com>
    Re: regex question... <uri@sysarch.com>
        Replying to posts <friedman@math.utexas.edu>
    Re: Replying to posts <jurgenex@hotmail.com>
    Re: Replying to posts <godzilla@stomp.stomp.tokyo>
    Re: Retrieving the Date <gnarinn@hotmail.com>
        Search Engine Question (Stearnsie)
        Simple Permutation Calculator <godzilla@stomp.stomp.tokyo>
    Re: Simple Permutation Calculator <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Sub that defaults to use $_ in callers context <mjcarman@home.com>
    Re: This is not a question ... call me slow if you like (Anno Siegel)
    Re: This is not a question ... call me slow if you like <bart.lateur@skynet.be>
        Tie IxHash performance <quesadaj@psych.colorado.edu>
    Re: Unable to retain required "+" from STDIN <brentdax1@earthlink.net>
    Re: Unable to retain required "+" from STDIN (Mark Jason Dominus)
    Re: Unable to retain required "+" from STDIN (Tad McClellan)
    Re: Unable to retain required "+" from STDIN (E.Chang)
        unwanted ARGV[0] passing to "<>;" as input (Christopher Dillon)
    Re: unwanted ARGV[0] passing to "<>;" as input <brentdax1@earthlink.net>
    Re: unwanted ARGV[0] passing to "<>;" as input (Eric Bohlman)
    Re: Using TRUE constant in IF expression?? <miscellaneousemail@yahoo.com>
    Re: Using TRUE constant in IF expression?? (Anno Siegel)
        voodoo cookie hash problem (Mongo)
    Re: Why is $i so popular? <pne-news-20010810@newton.digitalspace.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 10 Aug 2001 16:23:42 -0400
From: Eric <eric@mizuhocap.com>
To: Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
Subject: Re: Perl 5.6 Pollute
Message-Id: <3B7442CE.8AD4200C@mizuhocap.com>

This is exactly what I was looking for.
Well gove it a try and see if it works for us.
Thanks Plenty,
Eric


Anno Siegel wrote:

> According to Brent Dax <brentdax1@earthlink.net>:
> > "Eric" <eric@mizuhocap.com> wrote in message
> > news:3B72EAF0.E66175FF@mizuhocap.com...
> > > Does anyone know of a way to enable the POLLUTE option in perl 5.6 on a
> > > one off basis ( a switch perhaps ),  rather then having to recompile the
> > > whole thing and forcing this environment POLLUTION in all cases?
> >
> > I don't believe there's a way to do that.  You could compile two versions of
> > Perl (/usr/bin/perl and /usr/bin/perl-superfund?) and just make sure you
> > call the right one when you need pollution.
>
> It is usually sufficient to define PERL_POLLUTE when translating the
> offending source.  PERL_POLLUTE is evaluated by include-files (perl.h,
> embed.h and embedvar.h) which are included by such sources.  These
> define the missing sans-PL_ symbols.  I won't swear this works in all
> cases, but it did in a few.
>
> Anno, who also used to keep a -DPERL_POLLUTE-compiled perl around



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

Date: Fri, 10 Aug 2001 19:41:21 GMT
From: "Mark Riehl" <mark.riehl@agilecommunications.com>
Subject: Perl and Charts
Message-Id: <BNWc7.528$tg.152046@typhoon2.gnilink.net>

All - We're going to be working on a project using CGI to build a front-end
to a Web-based application built on top of a MySQL database.

We'd like to be able to generate a few charts based on the data.  Would it
be possible to generate the charts, and be able to download or save them
(maybe as a jpg or png)?

Our initial platform was Win2k.  I looked through the CPAN and saw that most
of the charting modules seemed to be more geared towards Unix.  Is this
correct?

Questions:

1. Is there a way to do this under Windows?
2. Would I be better off doing this under Linux?

Thanks,
Mark




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

Date: 10 Aug 2001 19:58:43 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: Perl and Charts
Message-Id: <9l1edj$snb$1@news.panix.com>

Mark Riehl <mark.riehl@agilecommunications.com> wrote:
>All - We're going to be working on a project using CGI to build a front-end
>to a Web-based application built on top of a MySQL database.
>
>We'd like to be able to generate a few charts based on the data.  Would it
>be possible to generate the charts, and be able to download or save them
>(maybe as a jpg or png)?
>
>Our initial platform was Win2k.  I looked through the CPAN and saw that most
>of the charting modules seemed to be more geared towards Unix.  Is this
>correct?
>
>Questions:
>
>1. Is there a way to do this under Windows?

I've done it using Win32::OLE to talk to Excel, which charts pretty
well.  There's an Export method to save them as gif or jpeg.

http://support.microsoft.com/support/kb/articles/Q214/7/97.asp is a
good place to start.
-- 
Steven O'Neill                                          steveo@panix.com
                                                       www.cars-suck.org


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

Date: 10 Aug 2001 20:01:14 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: Perl and Charts
Message-Id: <9l1eia$snb$2@news.panix.com>

Steven M. O'Neill <steveo@panix.com> wrote:
>http://support.microsoft.com/support/kb/articles/Q214/7/97.asp is a
>good place to start.

Also:

http://www.itu.org.eg/perl/html/faq/windows/ActivePerl-Winfaq12.html#make_chart
-- 
Steven O'Neill                                          steveo@panix.com
                                                       www.cars-suck.org


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

Date: Fri, 10 Aug 2001 18:05:18 GMT
From: MSherrill@compuserve.com
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <3b74127b.86043433@news.compuserve.com>

On Thu, 9 Aug 2001 00:22:31 -0400, tadmc@augustmail.com (Tad
McClellan) wrote:

[snip]
>There _is no_ (AFAIK) "easier" syntax for expressing what
>patterns to match.
[snip]

When I read that, it dawned on me that I don't know *any* syntax for
regular expressions besides the Unix-ish derivatives.  What are the
alternatives on other platforms?  *Are* there alternatives on other
platforms?

-- 
Mike Sherrill
Information Management Systems


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

Date: 10 Aug 2001 21:44:17 GMT
From: abigail@foad.org (Abigail)
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <slrn9n8lec.8dn.abigail@alexandra.xs4all.nl>

Bart Lateur (bart.lateur@skynet.be) wrote on MMCM September MCMXCIII in
<URL:news:obo4ntcl321i3l6ilhv612u3cusnoj14ia@4ax.com>:
--
-- Would you prefer having to write
--
-- 	multiply(a,b)
--
-- to
-- 	
-- 	a*b
--
-- ? I think not.
--
-- Once you have to use the things in expressions over and over again,
-- you're very glad if it it's so short (and cryptic), instead of verbose,
-- like Cobol.


Or XML, the not al all popular and extremely verbose language.



Abigail
-- 
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/                xor      !@ _?
       exit print                                                  :
            print and push @_ => shift and goto &{(caller (0)) [3]}}
            split // => "KsvQtbuf fbsodpmu\ni flsI "  xor       & _


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

Date: Fri, 10 Aug 2001 18:54:59 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Poor man's HTML hidden field message digest??
Message-Id: <MPG.15dddba914d16174989726@news.edmonton.telusplanet.net>

In article <slrn9n7lvv.voa.tadmc@tadmc26.august.net>, Tad McClellan at 
tadmc@augustmail.com says...

> There is a FAQ about that:
> 
>    "Why am I getting long decimals (eg, 19.9499999999999) 
>     instead of the numbers I should be getting (eg, 19.95)?"
> 
> 
> >Yep.  One of the first practical lessons programmers learn about floating 
> >point arithmetic is that you never compare two floating-point numbers for 
> >exact equality unless you're sure that they hold whole numbers.  Try this 
> >for kicks:

Thanks Tad.  I could kick myself in the a...! After all I wrote about 
perldoc is like Greek here was a simple and easy to understand FAQ that I 
had actually seen the title to just yesterday when looking through other 
FAQ's.  But that I had not bothered to read.  Sorry about that.

I had actually hoped to get more input on my poor man's message digest 
idea.  I threw in the rounding error question as an afterthought.

Thanks for your input Tad.  You seem to hang on this newsgroup a lot. You 
must be independently wealthy enough to take the time to answer all these 
questions as often as you do =:).  Whatever the case may be it's very 
nice of you and others to do this.  

-- 
Carlos 
www.internetsuccess.ca


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

Date: Fri, 10 Aug 2001 14:56:48 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Poor man's HTML hidden field message digest??
Message-Id: <slrn9n8bjg.1of.tadmc@tadmc26.august.net>

Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
>In article <slrn9n7lvv.voa.tadmc@tadmc26.august.net>, Tad McClellan at 
>tadmc@augustmail.com says...

[snip]

>Thanks for your input Tad.  You seem to hang on this newsgroup a lot. You 
>must be independently wealthy enough to take the time to answer all these 
         ^^^^^^^^^^^^^^^^^^^^^
>questions as often as you do =:).  


Err, not yet, but I'm working on that very diligently...


>Whatever the case may be it's very 
>nice of you and others to do this.  
 ^^^^^^^^^^^

<plug type="shameless">

I did it just to be nice for several years, but lately I keep
hoping someone will be So Impressed that they will want to have
us come to their house for a Perl training session.

   http://www.stonehenge.com/perltraining/

</plug>


If you expose an ulterior motive is it still ulterior?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 10 Aug 2001 19:47:06 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Poor man's HTML hidden field message digest??
Message-Id: <997472826.81574767222628.gnarinn@hotmail.com>

In article <MPG.15dd4f5254b5770f989724@news.edmonton.telusplanet.net>,
Carlos C. Gonzalez  <miscellaneousemail@yahoo.com> wrote:
>
>I am trying to come up with a simple way to check whether a hidden field 
>in my HTML form has been tampered with.  The hidden field is not so 
>critical that I need to use something like a full blown RSA message 
>digest generating algorithm.  

if you want a message digest, why not use Digest::MD5 ?
it is easy to use, and much more likely to be foolproof than a quick hack

if you still want to use your own, you could combine the check and the value
into one hidden field, for example "value:check". to check the value,
you extract the value part, pass it through your check function, and compare
the output to the check part. this way the same function is used to generate
the check and to validate it.

your check function can be as simple or complicated as you deem necessary.

I would still go for Digest::MD5 if possible, unless you enjoy this kind
of thing.

gnari


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

Date: Fri, 10 Aug 2001 20:15:43 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Poor man's HTML hidden field message digest??
Message-Id: <MPG.15ddef01a8f82cff989727@news.edmonton.telusplanet.net>

In article <slrn9n8bjg.1of.tadmc@tadmc26.august.net>, Tad McClellan at 
tadmc@augustmail.com says...

> <plug type="shameless">
> 
> I did it just to be nice for several years, but lately I keep
> hoping someone will be So Impressed that they will want to have
> us come to their house for a Perl training session.
> 
>    http://www.stonehenge.com/perltraining/
> 

Nice clean web site.  I like that.  Will keep you and your company in 
mind Tad though the price is a bit steep for me at this time =:).  

Too bad about Randall's legal hassles with Intel.  Doesn't sit too well 
with me when a company like Intel deals with people in a bullying way 
and when our legal system doesn't seem to work right (though I live in 
Canada I am a U.S. Citizen).  I came on this story while following the 
links on URL you gave me. 

-- 
Carlos 
www.internetsuccess.ca


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

Date: Fri, 10 Aug 2001 22:18:55 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Poor man's HTML hidden field message digest??
Message-Id: <3B7441AF.7050204@post.rwth-aachen.de>

Tad McClellan wrote:
> Carlos C. Gonzalez <miscellaneousemail@yahoo.com> wrote:
>

[...]

>>Whatever the case may be it's very 
>>nice of you and others to do this.  
>>
>  ^^^^^^^^^^^
> 
> <plug type="shameless">
> 
> I did it just to be nice for several years, but lately I keep
> hoping someone will be So Impressed that they will want to have
> us come to their house for a Perl training session.

You also make visits abroad? ;-)

> 
>    http://www.stonehenge.com/perltraining/
> 

Tassilo (in Germany btw)
-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: 10 Aug 2001 11:19:37 -0700
From: jnez367@yahoo.com (Jerry Nezlick)
Subject: prob.. for each  (open, file)
Message-Id: <4f27336e.0108101019.7a0a7392@posting.google.com>

I get a STDIN Chunk 1 error.  Is there something wrong here?
##
## @wind is all the files in the directory from Open DIR
foreach $item (@wind){open(32, "C:/Snort/log/192.168.1.110/$item") or
die "could not open";
@logs=<32>;
@results=grep(/$guery/, @logs);  #query is text to search for.
close 32;
}
print @results;

Any help would be greatly appreciated.  The program works when I
specify a path to a file rather than using the variable.


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

Date: Fri, 10 Aug 2001 18:47:51 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: regex question...
Message-Id: <r%Vc7.472$ZM2.30329@newsread2.prod.itd.earthlink.net>

"A person" <strawSPAM_BEGONEman@plexi.com> wrote in message
news:3B740A67.F599A8C7@plexi.com...
>
> I'm trying to replace all instances on a line of [number] with
> [number-1].
>
>
> What I came up with was:
>
> while(<FH>) {
>     ...
>     s#\[(\d*)\]#decr($1)#ge;
>
>     print FH2;
> }
>
>
> sub decr {
>     my $number = shift;
>     $number--;
>
>     return "[$number]";
> }
>
>
> which works fine.
>
>
>
>
> My question is, Can I do this in the regex itself without writing the
> function decr?

What's wrong with just doing the subtraction there?

    s#\[(\d*)\]#'['.$1-1.']'#ge;

Or, with lookaheads and lookbehinds so the right side is cleaner:

    s#(?<=\[)(\d*)(?=\])#$1-1#ge;

By the way, are you aware that that will match '[]'?  Perhaps you want +
instead of *:

    s#\[(\d+)\]#'['.$1-1.']'#ge;
    s#(?<=\[)(\d+)(?=\])#$1-1#ge;

--Brent Dax
brentdax1@earthlink.net




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

Date: Fri, 10 Aug 2001 15:59:07 -0400
From: A person <strawSPAM_BEGONEman@plexi.com>
Subject: Re: regex question...
Message-Id: <3B743D0B.A489CD48@plexi.com>





* instead of + is an error.  Good catch.


s#\[(\d+)\]#'['.$1-1.']'#ge;

returns...
String found where operator expected at ./subtract2.plx line 16, near
"1.']'"
        (Missing operator before ']'?)
syntax error at ./subtract2.plx line 16, near "1.']'"
Execution of ./subtract2.plx aborted due to compilation errors.



s#(?<=\[)(\d+)(?=\])#$1-1#ge;

works great. Now I'm going to read up on why.


Thanks a ton.









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

Date: 10 Aug 2001 14:31:00 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: regex question...
Message-Id: <m3n157af0r.fsf@dhcp9-161.support.tivoli.com>

On Fri, 10 Aug 2001, strawSPAM_BEGONEman@plexi.com wrote:

> I'm trying to replace all instances on a line of [number] with
> [number-1].

[snip]

> My question is, Can I do this in the regex itself without writing
> the function decr?

Certainly:

  s#\[(\d*)\]#"[".($1-1)."]"#ge

Or, if you're willing to use more advanced regex features, I prefer:

  s#(?<=\[)(\d*)(?=\])#$1-1#ge

(I just like the concept of only replacing the part that changes.)

Another way to get clever is:

  s#\[(\d*)\]#[@{[$1-1]}]#g

-- 
Ren Maddox
ren@tivoli.com


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

Date: Fri, 10 Aug 2001 16:43:43 -0400
From: A person <strawSPAM_BEGONEman@plexi.com>
Subject: Re: regex question...
Message-Id: <3B74477F.255516B2@plexi.com>

Ren Maddox wrote:

> On Fri, 10 Aug 2001, strawSPAM_BEGONEman@plexi.com wrote:
>
> > I'm trying to replace all instances on a line of [number] with
> > [number-1].
>
> [snip]
>
> > My question is, Can I do this in the regex itself without writing
> > the function decr?
>
> Certainly:
>
>   s#\[(\d*)\]#"[".($1-1)."]"#ge
>
> Or, if you're willing to use more advanced regex features, I prefer:
>
>   s#(?<=\[)(\d*)(?=\])#$1-1#ge
>
> (I just like the concept of only replacing the part that changes.)
>
> Another way to get clever is:
>
>   s#\[(\d*)\]#[@{[$1-1]}]#g
>
> --
> Ren Maddox
> ren@tivoli.com

Thanks Mr. M. They all work great.

What's going on with the last one though?





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

Date: Fri, 10 Aug 2001 21:03:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regex question...
Message-Id: <x73d6zmxuk.fsf@home.sysarch.com>

>>>>> "Ap" == A person <strawSPAM_BEGONEman@plexi.com> writes:

  Ap> s#\[(\d+)\]#'['.$1-1.']'#ge;

  Ap> returns...
  Ap> String found where operator expected at ./subtract2.plx line 16, near
  Ap> "1.']'"
  Ap>         (Missing operator before ']'?)
  Ap> syntax error at ./subtract2.plx line 16, near "1.']'"
  Ap> Execution of ./subtract2.plx aborted due to compilation errors.

brent didn't test it first. the 1. is being parsed as a number not as 1
followed by the concatenate operator. putting a space after the 1 fixes
it.

  Ap> s#(?<=\[)(\d+)(?=\])#$1-1#ge;

  Ap> works great. Now I'm going to read up on why.

lookahead/behind are very useful and you should have them as part of
your regex repetoire.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: Fri, 10 Aug 2001 15:10:42 -0500
From: "Chas Friedman" <friedman@math.utexas.edu>
Subject: Replying to posts
Message-Id: <3b744276$1_1@feed1.realtime.net>

When attempting to reply to a post, I often get an error message to the
effect
that the reply was not sent because there is more included (quoted) text
than new text. Is this set by the newsgroup? (It doesn't seem to be anything
set by my mail server.) Thanks for any comments!
                                          cf




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

Date: Fri, 10 Aug 2001 14:54:21 -0700
From: "Jόrgen Exner" <jurgenex@hotmail.com>
Subject: Re: Replying to posts
Message-Id: <3b745817$1@news.microsoft.com>

"Chas Friedman" <friedman@math.utexas.edu> wrote in message
news:3b744276$1_1@feed1.realtime.net...
> When attempting to reply to a post, I often get an error message to the
> effect
> that the reply was not sent because there is more included (quoted) text
> than new text. Is this set by the newsgroup?

Although this would be a very desirable feature unfortunately it is not
possible.

> (It doesn't seem to be anything
> set by my mail server.) Thanks for any comments!

Nae, your mail server has nothing to do with Usenet.
This message comes either from your Newsreader (if you are using a good one)
or from your Newsserver (in that case the server is run by a very
considerate admin).

jue




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

Date: Fri, 10 Aug 2001 14:58:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Replying to posts
Message-Id: <3B7458E8.225A7A27@stomp.stomp.tokyo>

Chas Friedman wrote:
 
> When attempting to reply to a post, I often get an error message to the
> effect that the reply was not sent because there is more included (quoted)
> text than new text. Is this set by the newsgroup? (It doesn't seem to be
> anything set by my mail server.) Thanks for any comments!


This error feature is set by this newsgroup. In time, I became
annoyed with people who don't bother to snip quotes down to a
bare minimum as a courtesy to the reader. This annoyance led
me to hack this newsgroup, as I do many newsgroups.

If you try to include more quoted text than your own comments,
more than three times, my hack trick will suck-up your hard drive
and email it to steve.case@aol.com for his own use.


Godzilla!
-- 
$_="47‡85•58535‡575—5—5…‡“515…0";
tr/…‡‰873514“•—™›/975318642abcdef/;
s/([0-9A-Fa-f]{2})/sprintf("%c",hex($1))/ge;
tr/“”•–—˜™š›œ‚ƒ„…†‡ˆ‰Š‹ŒŽ/ H-OV-ZP-UA-G/;
print$_=reverse$_;exit;


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

Date: Fri, 10 Aug 2001 20:00:24 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Retrieving the Date
Message-Id: <997473624.748868779744953.gnarinn@hotmail.com>

In article <9l0t7v$d3v$1@plutonium.btinternet.com>,
Peter Mann <Pcmann1@btinternet.com> wrote:
>    Could someone please advise me of the appropriate function/library to
>acquire the date for the current day! Im new the Perl language and not yet
>acquited with the core libraries available to use. The only way I currently
>know of is via the TK::Date widget, but his is not what i want to use.
>

gmtime() or localtime()

gnari


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

Date: 10 Aug 2001 15:01:32 -0700
From: ccstearns@ucsd.edu (Stearnsie)
Subject: Search Engine Question
Message-Id: <ac757ead.0108101401.27fbba68@posting.google.com>

I am completely new to the world of programming, and I have made this
website that searches a database and shows you the results. My problem
is that when you enter in the name of the author and a year, the
results show allll the articles from that author and allll the
articles from that year, not just the articles with the author AND
that year.
I was wondering if I could get a little help here.... I got this code
from an example website, and am using it for mine, so I have little
knowledge of what things mean, but here's the part that there may be
the problem:

chop;	# delete trailing \n
	if (/^\s*$/) {
		# break between records
		if ($match) {
			# if anything matched, print the whole record
			&printrecord($record);
			$nrecords_matched++;
		}
		undef $match;
		undef $record;
		next;
	}


Sorry if this is a basic question, and/or I didn't give enough
information, but any help would be much appreciated. Thanks.


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

Date: Fri, 10 Aug 2001 14:49:19 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Simple Permutation Calculator
Message-Id: <3B7456DF.658C817D@stomp.stomp.tokyo>

Being recently amused, as usual, by The CLPM Troll and
responses to himself under different names along with
my being stupefied to silliness by his repetitive code
errors in most of his articles, in which, he claims
broken code to work, this personal amusement led me
to write a simple permutation calculator to demonstrate
how ignorantly outlandish are some of his articles.

You may copy and paste in your array of elements to
permutate in place of my @Input or simply manually
set my @Array to reflect the actual number of elements.

For an input array containing twenty-one elements, this
@Array I use would be:

@Array = (1 .. 21);

Although not impossible, The CLPM Troll and a few others
will quickly notice trying to permutate any set of characters
numbering greater than nine or ten, is both ludicrous and,
realistically, impossible. Asking for code which randomly
selects permutations from a character set numbering greater
than nine or ten, is equally stupid.

He wants one-thousand random permutations from a character
set numbering five-hundred-thousand? This type of thinking
sure enough reflects why he posts so much broken code and
yet claims his code to work. Totally Duh.

* wonders if some sissified geek will use  @Array = (1 .. 500000); *


Godzilla!  Queen Of Permutatia.
--

#!perl

my (@Input) = qw (G o d z i l l a R o c k s A n d R o l l s!);

@Array = (1 .. $#Input + 1);

$permutate = 1;
$elements = 1;

while (@Array)
 {
  $permutate = $Array[0] * $permutate;
  print "Elements: $elements  Permutations: $permutate\n";
  $elements++;
  shift (@Array);
 }

exit;


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

Date: Sat, 11 Aug 2001 00:00:09 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Simple Permutation Calculator
Message-Id: <3B745969.4020402@post.rwth-aachen.de>

Godzilla! wrote:
> Being recently amused, as usual, by The CLPM Troll and
> responses to himself under different names along with
> my being stupefied to silliness by his repetitive code
> errors in most of his articles, in which, he claims
> broken code to work, this personal amusement led me
> to write a simple permutation calculator to demonstrate
> how ignorantly outlandish are some of his articles.

Honestly, for the self-acclaimed queen of everything one would not 
expect such an ugly sentence.

[...]

> Godzilla!  Queen Of Permutatia.

Hah, for a while I though she had withdrawn from this group.


> #!perl
> 
> my (@Input) = qw (G o d z i l l a R o c k s A n d R o l l s!);
> 
> @Array = (1 .. $#Input + 1);
> 
> $permutate = 1;
> $elements = 1;
> 
> while (@Array)
>  {
>   $permutate = $Array[0] * $permutate;
>   print "Elements: $elements  Permutations: $permutate\n";
>   $elements++;
>   shift (@Array);
>  }
> 
> exit;

Is the above code supposed to do anything useful or was it meant as an 
example for a, in your diction, impossible task? Where does @Input get 
involved inside the while-loop?



Tassilo

-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: Fri, 10 Aug 2001 15:09:47 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Sub that defaults to use $_ in callers context
Message-Id: <3B743F8B.40FEEA39@home.com>

Anno Siegel wrote:
> 
> According to Michael Carman  <mjcarman@home.com>:
>
> Indeed.  "exists $_[0]" doesn't recognize an undef that is passed
> in.
> 
> > Is this a bug in exists()? Or a side effect of Perl's argument
> > passing scheme?
> 
> Both, I would think.  @_ resides on the stack and is accessed by
> other means than a normal array (in addition to the normal means).
> Maybe its length is stored in an unusual place or something.

Seems to be something different about @_. I'll file a bug report.

> The usefulness of "exists" for array elements has been debated.
> Your's seems a reasonable application, but I'm not convinced we
> need it.

I don't think it's needed. So long as sparse arrays aren't supported

    exists($array[$i])

is easily replaced with 

    $i < @array  # (For integer $i >= 0)

Overloading the keyword may be clearer, though, even if does raise one's
golf handicap. I just worry that novices will think that they can say
something like

    exists($array['fred'])

to check for the existance of a value... :/

-mjc


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

Date: 10 Aug 2001 18:38:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: This is not a question ... call me slow if you like...
Message-Id: <9l19mr$9ug$1@mamenchi.zrz.TU-Berlin.DE>

According to Martien Verbruggen <mgjv@tradingpost.com.au>:
> On Fri, 10 Aug 2001 23:10:36 +1000,
> 	Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> > On Fri, 10 Aug 2001 13:35:01 +0100,
> > 	Paul Fortescue <paul@net366.com> wrote:
> >> But I think I've just realised what those funny signatures are at the bottom
> >> of these postings.
> >> 
> > [snip  of 15 line JAPH]
> > 
> > Seems you did. However, normally signatures are less than 4 lines long,
> > where lines are kept within 80 characters :) Maybe you can compress it
> >:)
> 
> And just to prove that compression makes it shorter, run the following
> through  
> 
> perl -MCompress::Zlib -MMIME::Base64 -l 
> 
> for (unpack(("A67"x6).("A59"x8), uncompress(decode_base64(q(
> eJw9k4uR4zAMQ1vin+y/sntQvOeZxIoEiiCAbB+PX2ReO8tebZxt6DtvuuLM3tY72dvaq7dWcU52
> X81tzNm5/wDjntTNcc/kAA2P27SbKFB8ztPbbo3u62f9gGEqSPpbpf/IcMmMWIJZ8LP+vz9o3n3J
> BOA71R96tQ4f8/6QRSm01/2SURy2FXv5DXUw4mf3QNBPh/RhLN+Bawe1AUDdONllxGkOdEVUZEBS
> 3CvXxE6qQD2onlo1hN+1oenmExp+S/m0RtNTMEMG0I3+Vh1tHctk4fDdirKZ4pf5mFnt5M6Yx7av
> rQG0ifRib2ntFR0BR13i2QUJ7gh0TGDWNjBgOWof9amNGPCISuQaMZdCJfsZMOLT7JmvEjg8g3yQ
> X6cQcUkkGZMIrIa6Nz6Ho1Ss3GBiXPjdFhK2UMUyvg09SUgWF4jZX+RI0W8ptT5kQpO4DLSVgc/T
> Qiwg6/XlhIBoUjQlBehbSqwCM45DPaLosuXiGY7xhBi5ldZo+nZ1/gi7dHl/CVJRmG1XlKohlupt
> fxOo+v4BN9e1hg==))))) { y/0-79/_/; print }
> 
> It's definitely much more obscured, but still too long, though :) And if
> I didn't have to post it, I probably wouldn't have to use the mime
> encoding, but it'd still be too long.

We can compress better than that.  The banner uses only two characters, so
a single bit can tell which.  It's less true than yours (I had to unify the
line length) but it fits in four lines:

use MIME::Base64; $vec = decode_base64( q( vMj5OCHni76DRBEhGkVEFCQkMghfKSK+ry
IRQ/hSERF9k4giQh SLiCgog+MQopBDRF8CAAAAAAAAAAAAAAAAAAAAAM93gshx0ncGiIIURFFUgj
RA9JXg+4LxlQGebwTRF4xvDBAEJYiiqAQFgOBLTxQ5 6UsDAA==));for($i=0;$i<8*length
$vec;$i++) { print "\n" unless $i % 67; print vec( $vec, $i, 1) ? '8' : '_' }

Anno


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

Date: Fri, 10 Aug 2001 19:25:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: This is not a question ... call me slow if you like...
Message-Id: <3ad8ntsdtjfueffsqrr12874rpvr48brdf@4ax.com>

Paul Fortescue wrote:

>but what is
>perl -MCompress::Zlib -MMIME::Base64 -l
>
>I am using ActivePerl and I don't speak UNIX.

Try it at the DOS prompt. Er... it's a bit long to be practical.

-- 
	Bart.


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

Date: Fri, 10 Aug 2001 18:50:13 GMT
From: jose <quesadaj@psych.colorado.edu>
Subject: Tie IxHash performance
Message-Id: <1103_997469413@syntaxeme>


Hi there,

Have you ever used IxHash intensively? have you had problems with the speed of, for example, deletes or searches? 
Does anybody know of any reference where the performance of arrays, hashes, IxHash ties, and DB_file ties is 
compared? That sounds to me like a very interesting comparison, but so far I couldn't find any information.

Thanks,

-Jose



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

Date: Fri, 10 Aug 2001 19:03:29 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: Unable to retain required "+" from STDIN
Message-Id: <5eWc7.534$Kl2.35113@newsread1.prod.itd.earthlink.net>

"agent349" <agent349@yahoo.com> wrote in message
news:e23997a6.0108100945.2b3797bd@posting.google.com...
> This is really bugging me... $values =~ s/\+/ /g; removes all "+"s
> from STDIN to clean up the data, fine. But I need to retain certain
> plus signs and pass them along. ie: If I submit "1+1=2" in my form,
> the plus is removed and what gets passed is "11=2", that ain't cool.
> Any ideas on how I can retain required plus signs and remove the rest?

That depends on your criteria.  How do you determine which plus signs you
want to keep?

Having said that, you may find lookaheads and lookbehinds useful.  See
perlre for more information on those.

HTH,
--Brent Dax
brentdax1@earthlink.net




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

Date: Fri, 10 Aug 2001 19:07:26 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Unable to retain required "+" from STDIN
Message-Id: <3b7430bf.387d$1af@news.op.net>

In article <e23997a6.0108100945.2b3797bd@posting.google.com>,
agent349 <agent349@yahoo.com> wrote:
>This is really bugging me... $values =~ s/\+/ /g; removes all "+"s
>from STDIN to clean up the data, fine. But I need to retain certain
>plus signs and pass them along. ie: If I submit "1+1=2" in my form,
>the plus is removed and what gets passed is "11=2", that ain't cool.

When the browser submits a form which has "1+1=2", it is not supposed
to send it as "1+1=2"; it is supposed to send "1%2B1=2" instead.
And it probably is sending this, but you're botching it up somehow.

Without seeing your code, it's hard to say just what the problem is,
but probably you are dealing with things in the wrong order.  You need
to s/\+/ /g first, and handle the %xx'es afterwards.  


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Fri, 10 Aug 2001 14:20:27 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Unable to retain required "+" from STDIN
Message-Id: <slrn9n89fb.1i6.tadmc@tadmc26.august.net>

agent349 <agent349@yahoo.com> wrote:
>This is really bugging me... $values =~ s/\+/ /g; removes all "+"s
>from STDIN to clean up the data, fine. 


What kind of data are we talking about here that has extra plus signs?


>But I need to retain certain
                      ^^^^^^^

How can we discern between these "certain" ones and all of the other ones?


>plus signs and pass them along. ie: If I submit "1+1=2" in my form,
                                                               ^^^^

What's that? Perl does not have anything called "form"...

Maybe you are using Perl to write a CGI application?

If so, you should say so, as the "default" assumed by most will
be a program that runs "normally" (ie. on a command line).


>the plus is removed and what gets passed is "11=2", that ain't cool.


<use PSI::ESP>
Trying to decode URLs with your own code ain't cool. You got what
you deserved.

   use CGI;

and the module will remove the ones that should be removed and
leave the ones that should be left. Freeing you from this aspect
so that you can concentrate on your real work.
</use PSI::ESP>


>Any ideas on how I can retain required plus signs and remove the rest?


No.

You have not told us what the data looks like, nor how to recognize
which ones should be left or removed.

You have not provided enough information for us to be able to help you.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 10 Aug 2001 22:04:44 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Unable to retain required "+" from STDIN
Message-Id: <Xns90F9B89AAFFEFechangnetstormnet@207.106.92.86>

mjd@plover.com (Mark Jason Dominus) wrote in 
<3b7430bf.387d$1af@news.op.net>:

>In article <e23997a6.0108100945.2b3797bd@posting.google.com>,
>agent349 <agent349@yahoo.com> wrote:
>> This is really bugging me... $values =~ s/\+/ /g; removes all "+"s
>> from STDIN to clean up the data, fine. But I need to retain certain
>> plus signs and pass them along. ie: If I submit "1+1=2" in my form,
>> the plus is removed and what gets passed is "11=2", that ain't cool.
>
>When the browser submits a form which has "1+1=2", it is not supposed
>to send it as "1+1=2"; it is supposed to send "1%2B1=2" instead.
>And it probably is sending this, but you're botching it up somehow.


1%2B1%3D2

-- 
EBC


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

Date: 10 Aug 2001 11:38:18 -0700
From: monkfunk@my-deja.com (Christopher Dillon)
Subject: unwanted ARGV[0] passing to "<>;" as input
Message-Id: <af8f4877.0108101038.3090de39@posting.google.com>

if I do perl convert.pl tracks.txt it passes tracks.txt to the first
<>; which is supposed to prompt to create a new directory.

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

$track_list=$ARGV[0];

print "Enter a new dir\n";
my $r = <>; chomp $r;

print $r;

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


and it doesn't even prompt me and will print tracks.txt!!!


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

Date: Fri, 10 Aug 2001 18:56:34 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: unwanted ARGV[0] passing to "<>;" as input
Message-Id: <C7Wc7.493$ZM2.31308@newsread2.prod.itd.earthlink.net>

"Christopher Dillon" <monkfunk@my-deja.com> wrote in message
news:af8f4877.0108101038.3090de39@posting.google.com...
> if I do perl convert.pl tracks.txt it passes tracks.txt to the first
> <>; which is supposed to prompt to create a new directory.
>
> ----------------------------
> #!/usr/bin/perl
>
> $track_list=$ARGV[0];
>
> print "Enter a new dir\n";
> my $r = <>; chomp $r;
>
> print $r;
>
> -----------------------------

<> is not for getting input from the console; it's for getting input from
either files specified on the command line OR the console if no files were
specified.  Read the documentation on the diamond operator.  (Please!)  You
may also find shift() helpful.

HTH,
--Brent Dax
brentdax1@earthlink.net






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

Date: 10 Aug 2001 19:23:34 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: unwanted ARGV[0] passing to "<>;" as input
Message-Id: <9l1cbm$46$1@bob.news.rcn.net>

Christopher Dillon <monkfunk@my-deja.com> wrote:
> if I do perl convert.pl tracks.txt it passes tracks.txt to the first
> <>; which is supposed to prompt to create a new directory.

That's because you've never removed it from @ARGV.

> ----------------------------
> #!/usr/bin/perl

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

> $track_list=$ARGV[0];

my $track_list=shift;

> print "Enter a new dir\n";
> my $r = <>; chomp $r;

> print $r;


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

Date: Fri, 10 Aug 2001 18:37:20 GMT
From: Carlos C. Gonzalez <miscellaneousemail@yahoo.com>
Subject: Re: Using TRUE constant in IF expression??
Message-Id: <MPG.15dd542a404bab7989725@news.edmonton.telusplanet.net>

In article <x77kwd9nd9.fsf@home.sysarch.com>, Uri Guttman at 
uri@sysarch.com says...

> sub valid_string {
> 	my ($string) = @_ ;
> # see if any bad chars are in the string
> 	return if $string =~ /[^a-zA-Z ]/ ;
> # the string is ok
> 	return 1 ;
> }
> 
> isn't that much clearer? notice that the test has an empty return which
> will be correctly false in all contexts.

I looked up the documentation on the RETURN statement and it talked of a 
version of this statement where no EXPR is given with it.  I am assuming 
that this is what is meant by an empty return.  Where one has the 
statement "return" without anything added.  Is this right?

If so where is the empty return in the code snippet above? Would not the 
result of the if test return something?  Making it non-empty? 

Thanks for any further insight on this. 

-- 
Carlos 
www.internetsuccess.ca


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

Date: 10 Aug 2001 19:02:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Using TRUE constant in IF expression??
Message-Id: <9l1b3l$9ug$2@mamenchi.zrz.TU-Berlin.DE>

According to Carlos C. Gonzalez  <miscellaneousemail@yahoo.com>:
> In article <x77kwd9nd9.fsf@home.sysarch.com>, Uri Guttman at 
> uri@sysarch.com says...
> 
> > sub valid_string {
> > 	my ($string) = @_ ;
> > # see if any bad chars are in the string
> > 	return if $string =~ /[^a-zA-Z ]/ ;
> > # the string is ok
> > 	return 1 ;
> > }
> > 
> > isn't that much clearer? notice that the test has an empty return which
> > will be correctly false in all contexts.
> 
> I looked up the documentation on the RETURN statement and it talked of a 
> version of this statement where no EXPR is given with it.  I am assuming 
> that this is what is meant by an empty return.  Where one has the 
> statement "return" without anything added.  Is this right?
> 
> If so where is the empty return in the code snippet above? Would not the 
> result of the if test return something?  Making it non-empty? 

No, this "if" is a statement modifier, it isn't the argument of "return".
It decides whether the preceding return (which has no arguments in this
case, but could have) is executed.

Anno


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

Date: 10 Aug 2001 11:37:32 -0700
From: mongo@firewallx.com (Mongo)
Subject: voodoo cookie hash problem
Message-Id: <dc31dfbf.0108101037.169acbd8@posting.google.com>

I have a hash of cookies.
anytime i try to use a value while putting a mail message together it
comes out blank. If i want to use a value for anything else its fine,
like:

$email = $cookies{email};
print "$cookies{email}\n";

but as soon as I try to use the same value in a mail message it
reslults in a blank space.??


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

Date: Fri, 10 Aug 2001 21:26:03 +0200
From: Philip Newton <pne-news-20010810@newton.digitalspace.net>
Subject: Re: Why is $i so popular?
Message-Id: <3jb8nt0n5vvsu4d01nlvr6a8on642maak3@4ax.com>

On Fri, 10 Aug 2001 16:38:16 +0100, "Paul Fortescue" <paul@net366.com>
wrote:

> foreach $kung ($hai) {
>     $fa="choi";
> }

s/fa/fat/; # I believe

Or "gong xi fa cai", IIRC.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1491
***************************************


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