[18866] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1034 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 1 06:05:44 2001

Date: Fri, 1 Jun 2001 03:05:11 -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: <991389911-v10-i1034@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 1 Jun 2001     Volume: 10 Number: 1034

Today's topics:
    Re: Clarification and question about FAQ (David Combs)
    Re: Clarification and question about FAQ (David Combs)
        compile option -P <ebierhof@tdn.nl>
    Re: FLOCK numericals? <07950232225@one2one.net>
    Re: FLOCK numericals? (Anno Siegel)
        html page creation from html using perl <michael_of_neb@MailAndNews.com>
    Re: html page creation from html using perl <godzilla@stomp.stomp.tokyo>
        module for MS SQL <nospam@newsranger.com>
    Re: Net::SMTP -- why must I specify recipient twice? <pne-news-20010601@newton.digitalspace.net>
    Re: Net::SMTP -- why must I specify recipient twice? <krahnj@acm.org>
    Re: NEWBIE - Can't run a perl script <clive@bromley.ac.uk>
    Re: Newbie Post : Flushing output for long scripts <07950232225@one2one.net>
    Re: Parsing the arrow operator -> into English (Guy Worthington)
    Re: perl and Informix <07950232225@one2one.net>
    Re: Perl and pdf-files <tward10@jaguar.com>
        Perl and Unicode <c.ko@gmx.de>
    Re: Perl and Unicode (Bernard El-Hagin)
    Re: Perl and Unicode <07950232225@one2one.net>
    Re: Posting Etiquette (Sam Holden)
    Re: Posting Etiquette <uri@sysarch.com>
    Re: Posting Etiquette (Eric Bohlman)
    Re: Problem with matching with variable regular express <krahnj@acm.org>
    Re: Problem with matching with variable regular express <godzilla@stomp.stomp.tokyo>
        Rename .htm to .html (felan)
    Re: Rename .htm to .html (Bernard El-Hagin)
    Re: Rename .htm to .html (felan)
    Re: Rename .htm to .html (Bernard El-Hagin)
    Re: Rounding <webmaster@webdragon.unmunge.net>
    Re: Rounding <webmaster@webdragon.unmunge.net>
    Re: Rounding (Anno Siegel)
    Re: Rounding <ron@savage.net.au>
    Re: The FlakeyMind/Bryce Jacobs FAQ (v0.1) <jcoffin@taeus.com>
    Re: Unsure about headers <webmaster@webdragon.unmunge.net>
    Re: Using Perl to keep track on internet usage? <07950232225@one2one.net>
    Re: Variablen durch Formular <mm@mamemu.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 1 Jun 2001 07:08:17 GMT
From: dkcombs@panix.com (David Combs)
Subject: Re: Clarification and question about FAQ
Message-Id: <9f7f11$jbk$1@news.panix.com>

In article <3B11A440.B1CDC7A0@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Tad McClellan wrote:
>>    http://dfw.pm.org/clpmisc.shtml
>
>This is not the FAQ for this newsgroup. This is a
>document you wrote and reflects only your viewpoints.
>There are many participants here whom take exception
>with this personal document of yours. Be sure you are
>clear on this notion, this is not the FAQ for this group.
>
>Godzilla!

ex godzilla-response.txt
1,$s/this/that/g
/clear on this/s/that/this/
x



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

Date: 1 Jun 2001 07:11:34 GMT
From: dkcombs@panix.com (David Combs)
Subject: Re: Clarification and question about FAQ
Message-Id: <9f7f76$jbk$2@news.panix.com>

In article <9f7f11$jbk$1@news.panix.com>,
David Combs <dkcombs@panix.com> wrote:
>In article <3B11A440.B1CDC7A0@stomp.stomp.tokyo>,
>Godzilla! <godzilla@stomp.stomp.tokyo> wrote:

>>This is not the FAQ for this newsgroup. This is a
>>document you wrote and reflects only your viewpoints.
>>There are many participants here whom take exception
>>with this personal document of yours. Be sure you are
>>clear on this notion, this is not the FAQ for this group.
>
>ex godzilla-response.txt
>1,$s/this/that/g
>/clear on this/s/that/this/
>x
>

Oops -- untested ex-script!
/clear on/s/that/this/

D.
(still untested!)



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

Date: Fri, 1 Jun 2001 08:36:41 +0200
From: "Erik Bierhof" <ebierhof@tdn.nl>
Subject: compile option -P
Message-Id: <9f7d5q$t2v$1@news1.xs4all.nl>


What will I have to do before the -P compile option  will work on  a
NT4.0-system.
The -P option will pre-compile the script with a C-compiler.

Erik.




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

Date: Fri, 01 Jun 2001 09:53:45 +0100
From: John Imrie <07950232225@one2one.net>
Subject: Re: FLOCK numericals?
Message-Id: <3B175819.3F55CED1@one2one.net>



Anonymous Coward wrote:

> Additionally don't unlock a file before closing it unless you have a very
> specific reason.  The close() call will unlock the file if it is locked.
>  Unlocking a file before closing it can result in a classic race scenerio.
>  If you do not know what this means then don't use LOCK_UN.

I don't dout your assumption about close but where in the documentation does it say this



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

Date: 1 Jun 2001 09:36:23 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FLOCK numericals?
Message-Id: <9f7nmn$7eq$1@mamenchi.zrz.TU-Berlin.DE>

According to John Imrie  <07950232225@one2one.net>:
> 
> 
> Anonymous Coward wrote:
> 
> > Additionally don't unlock a file before closing it unless you have a very
> > specific reason.  The close() call will unlock the file if it is locked.
> >  Unlocking a file before closing it can result in a classic race scenerio.
> >  If you do not know what this means then don't use LOCK_UN.
> 
> I don't dout your assumption about close but where in the documentation
> does it say this

It doesn't say so, it's implicit.  When you unlock a file without
closing it (and keep the file open for a reason) you are giving
up lock protection against concurrent access.  You can only do
that safely when you *know* there won't be any access except your
own, which is a relatively rare situation.

Anno


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

Date: Fri, 1 Jun 2001 01:22:26 -0400
From: Michael <michael_of_neb@MailAndNews.com>
Subject: html page creation from html using perl
Message-Id: <3B1AEF15@MailAndNews.com>

I=92m stumped.
I could use some pointers.
I=92m using a web hosting provider whose perl/lib may not be everything that 
it 
could be.
I want to :
1. use a web page with a login/password capability;
(I=92ve made a primitive one of these, but I haven=92t yet made the 
login/password 
file secure for the web, and I could use some help with this piece too.)
2. then, based on this successful login, I want to create a file (actually a 
name.html web page in a specific path location), then write to it;
(I=92ve tried a few methods, but they don=92t seem to work.  They won=92t pass the 
=93open=94 (nor sysopen) method. Sadly, I don't get useful error messages 
either.)
3. finally, I then want to close this new html file, and redirect the 
browser 
to this new page.

I want this html file to persist for a while so that the browser might go to 
the various other locations of reports indicated in this page, and still 
return to it to go to other locations.

Am I trying to do something stupid ?

Is there a more standard manner (remember I am using some hosting company=92s 
perl library, which may not have some modules that I need) of creating a 
page 
that is then used to go to other locations from it ?

I call this process:
html page creation from html using perl

If you've got a clue, or a better method that will work from the standard 
hosting provider's version of perl, I'd be quite grateful.

Thanks.
Mike

------------------------------------------------------------
 Get your FREE web-based e-mail and newsgroup access at:
                http://MailAndNews.com

 Create a new mailbox, or access your existing IMAP4 or
 POP3 mailbox from anywhere with just a web browser.
------------------------------------------------------------



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

Date: Thu, 31 May 2001 22:33:05 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: html page creation from html using perl
Message-Id: <3B172911.D36FA9E8@stomp.stomp.tokyo>

Michael wrote:

(snipped)

> I call this process:
> html page creation from html using perl


This is nice.

Do you have code to post and specific questions
to ask about your code? If so, make it so.


Godzilla!


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

Date: Fri, 01 Jun 2001 09:00:31 GMT
From: rich <nospam@newsranger.com>
Subject: module for MS SQL
Message-Id: <PQIR6.241$v4.3542@www.newsranger.com>


Hi,
I usually use the MySQL database along with the module, DBI::MYSQL. For one
reason or another I have to use Microsofts SQL server now. Could anybody
recommend the best module for connecting to this database?

Thanks in advance
Rich




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

Date: Fri, 01 Jun 2001 09:35:01 +0200
From: Philip Newton <pne-news-20010601@newton.digitalspace.net>
Subject: Re: Net::SMTP -- why must I specify recipient twice?
Message-Id: <v0gehtsv2lifa2ag97vdcd4i7qan8ishdv@4ax.com>

On 31 May 2001 14:15:15 -0700, mnemotronic@yahoo.com (pt) wrote:

> The example for Net::SMTP show the recipient being specified twice:
> 
> $smtp->mail($ENV{USER});
> $smtp->to('postmaster');
> $smtp->data();
> $smtp->datasend("To: postmaster\n");
> [snip]
> 
>    I'm guessing the 'to' method does the SMTP "RCPT TO:",

Yes. This is RFC821.

> while the 'datasend' does the SMTP "To" header.

No; it sends part of an RFC822 message.

> Are both necessary?

No; only the first is. However, RFC822 says, IIRC, that there must be
either a "To:" header containing at least one address or a "Bcc:" header
(which may be empty), so if you want a proper message, you should
probably have a "To:" header in the RFC822 part.

(Note that the two addresses may be different; for example, for a
mailing list you might conceivably have
$smtp->to('real.subscriber.address@example.com') but later
$smtp->datasend("To: mailing-list-address@lists.example.com\n").

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: Fri, 01 Jun 2001 09:49:36 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Net::SMTP -- why must I specify recipient twice?
Message-Id: <3B176552.6D4F2FD4@acm.org>

Philip Newton wrote:
> 
> On 31 May 2001 14:15:15 -0700, mnemotronic@yahoo.com (pt) wrote:
> 
> > The example for Net::SMTP show the recipient being specified twice:
> >
> > $smtp->mail($ENV{USER});
> > $smtp->to('postmaster');
> > $smtp->data();
> > $smtp->datasend("To: postmaster\n");
> > [snip]
> >
> >    I'm guessing the 'to' method does the SMTP "RCPT TO:",
> 
> Yes. This is RFC821.

Now RFC 2821

> > while the 'datasend' does the SMTP "To" header.
> 
> No; it sends part of an RFC822 message.

Now RFC 2822



John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 1 Jun 2001 08:02:20 +0100
From: "Clive Gould" <clive@bromley.ac.uk>
Subject: Re: NEWBIE - Can't run a perl script
Message-Id: <9f7ejr$aeb$1@canard.ulcc.ac.uk>

Thanks very much - problem sorted with the addition of an appropriate
content header

Clive


"Clive Gould" <clive@bromley.ac.uk> wrote in message
news:9f590n$41v$1@canard.ulcc.ac.uk...
> Help - I am running Apache 1.3.19-5 under Redhat 7.1
>
> I have a perl script which reads:
>
> #!/usr/bin/perl
> print "Hello Perly World /n";
>
> I can run a perl script from the command line just by typing ./trivial and
> it prints
> "Hello Perly World"
>
> I am now trying to run the same script using Apache by typing
>
> http://mypc/trivial.pl
>
> I have enabled CGI scripting.
>
> Internet Explorer 5.5 on the client reports an Internal Server Error 500
>
> The appropriate error log entry for Apache reads:
>
> ..malformed header from script. Bad Header=Hello Perly World:
> /var/www/html/trivial.pl
>
> What am I doing wrong?
>
> Thanks
>
> Clive
>
>
>




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

Date: Fri, 01 Jun 2001 09:08:06 +0100
From: John Imrie <07950232225@one2one.net>
Subject: Re: Newbie Post : Flushing output for long scripts
Message-Id: <3B174D66.87A211F8@one2one.net>



Stefan Weiss wrote:

> Ben Holness <bholness@nortelnetworks.com> wrote:
>
> > I put this in a print statement, but that doesn't seem to get to the browser
> > until the whole script is finished, or the user presses stop. Is there any
> > way to force it out while the script is still running?
>
> Yes.
> $| = 1;
> see `perldoc perlvar`
>
> cheers,
> stefan

Actualy that probably wont work either as a web browser does not have to display a
page untill it has it all.

What you require is Server Push with a multipart document see the documentation
for CGI.pm



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

Date: 31 May 2001 21:17:39 -0700
From: guyw@multiline.com.au (Guy Worthington)
Subject: Re: Parsing the arrow operator -> into English
Message-Id: <33f78556.0105312017.3a4cd548@posting.google.com>

>>Rehashing my own question: How do I describe in English 
>>the expression   $pointer->{$i}.

uri@sysarch.com (Uri Guttman) replied with a clear and concise
translation:
>	$foo->{'bar'}
>
>get the 'bar' element from the hash referred to by foo.

I'll steal that line, and put it in my code comments, until
I start thinking in Perl.

Thanks also to Damian James, who patiently explained why my
use of the expression   $$pointer{$i}  is not proper---you've
relieved me of one of my wrongly formed ideas, from now I'll
write that as   ${$pointer}{$i}  as Perl intended.


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

Date: Fri, 01 Jun 2001 09:46:47 +0100
From: John Imrie <07950232225@one2one.net>
Subject: Re: perl and Informix
Message-Id: <3B175677.44F915A8@one2one.net>

> So it can be done! The most usual thing people do on Windows is to install
> Active Perl, but I'm not at all sure of how easy it will be to put the DBD
> and Tk into it. Perhaps it's just as easy if you have the C compiler?

Tk is easy to get with Active Perl.

run 'ppm install Tk' from a DOS prompt.

This link http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/Packages
will give you a list of all the other precompiled packages you can get with ppm

See the Active State ppm documentation for more info



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

Date: Fri, 1 Jun 2001 07:29:38 +0100
From: "Trevor Ward" <tward10@jaguar.com>
Subject: Re: Perl and pdf-files
Message-Id: <9f7coj$t483@eccws12.dearborn.ford.com>

PDF Files are normally compressed with lots of control characters and layout
characters within them..

My suggestion would be to download the PDF technical manual in PDF format
from the Adobe web site www.adobe.com.  And write your own module to extract
the text. Oh yes then probably post it to cpan as this is not the first
request for such a module.

Hope this helps

Søren Boll Overgaard <boll@fw1.dk> wrote in message
news:slrn9hdiv5.2g8f.boll@treebeard.tolkien.dk...
> Hello
>
> I am trying to figure out how to actually make perl read text from a
> pdf-file. So far I've been unsuccessful.
> The misc modules, apparantly, are written to do much more advanced stuff
> than what I currently. I've been reading the perldoc's, but I can't seem
to
> get the modules work they way I want them to.
> I pretty much need a way to open a pdf-file, read any text from it, and
put
> it into a scalar.
> Admittedly, I have no idea what a pdf-file contains, or how it's
formatted,
> but I am assuming that reading content from it in the above specified
manner
> should be possible.
>
> Any suggestions would be greatly appreciated.
>
> --
> Søren O.
>
> If idiots could fly, IRC would be an airport




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

Date: Fri, 1 Jun 2001 09:05:09 +0200
From: "Christian Koch" <c.ko@gmx.de>
Subject: Perl and Unicode
Message-Id: <3b173ee5$1@news.nefonline.de>

Hi,

I want to insert data in unicode format into an oracle-db. My input is a
file with unicode-values. All these values must be converted into the
unicode-signs.

Is it possible to use Perl and Unicode? How can I use it? What functions are
available to transform unicode-signs and values?

Thanks.
Christian




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

Date: Fri, 1 Jun 2001 07:09:52 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Perl and Unicode
Message-Id: <slrn9hef9a.com.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 1 Jun 2001 09:05:09 +0200, Christian Koch <c.ko@gmx.de> wrote:
>Hi,
>
>I want to insert data in unicode format into an oracle-db. My input is a
>file with unicode-values. All these values must be converted into the
>unicode-signs.
>
>Is it possible to use Perl and Unicode? How can I use it? What functions are
>available to transform unicode-signs and values?

Sigh.

perldoc perlunicode

Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print print;'


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

Date: Fri, 01 Jun 2001 10:25:21 +0100
From: John Imrie <07950232225@one2one.net>
Subject: Re: Perl and Unicode
Message-Id: <3B175F81.17ABD8C2@one2one.net>



Christian Koch wrote:

> Hi,
>
> I want to insert data in unicode format into an oracle-db. My input is a
> file with unicode-values. All these values must be converted into the
> unicode-signs.
>
> Is it possible to use Perl and Unicode? How can I use it? What functions are
> available to transform unicode-signs and values?
>
> Thanks.
> Christian

Unicode support in Perl is still Experimental. IE don't expect your script to
work if you update Perl.

The easyist way to get the uni-code signs would be to parce the Names.txt file
in the lib/unicode directory.

PS. If any one knowes better pleas let me know.



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

Date: 1 Jun 2001 04:07:18 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Posting Etiquette
Message-Id: <slrn9he57m.6jk.sholden@pgrad.cs.usyd.edu.au>

On Fri, 01 Jun 2001 03:46:37 GMT, Rob <> wrote:
>
>"Uri Guttman" <uri@sysarch.com> wrote in message
>news:x7n17szx1n.fsf@home.sysarch.com...
>> >>>>> "R" == Rob  <"relaxedrob@optushome.com.au"> writes:
>>
>>   >> I (and I expect, many others) will not be seeing any of your posts.
>>   >>
>>   >> That is what "killfile" means.
>>   >>
>>
>>   R> That is what 'threat' means.
>>
>> poor you. you have no clue. killfiling will not directly affect you so
>> there is no threat. it just means you will not get help from most of the
>> people here.
>
>And that is the threat.
>Thank you for being such a friendly person.

Strange logic...

You claim that killfiling is a threat. And yet in the same post you also said
the person should just not reply to your posts - which is what killfiling is
meant to do. No point reading if you have no intention of replying - one way
communication isn't much fun.

Telling you that 'I will no longer see any of  your posts' is somehow a threat?

You would prefer to think that people are reading your posts and just not 
replying?

Or maybe you would prefer to not be killfiled in the first place - in which
case you probably should not have offered that as the solution (don't reply
to my posts). Or perhaps you should have acted like a Roman when in Rome, and
put up with the strange (to some) customs in this particular group instead
of bickering with the natives.

-- 
Sam

Fifty years of programming language research, and we end up with C++ ???
                --Richard A. O'Keefe


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

Date: Fri, 01 Jun 2001 04:11:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Posting Etiquette
Message-Id: <x7k82wzvnh.fsf@home.sysarch.com>

>>>>> "SH" == Sam Holden <sholden@pgrad.cs.usyd.edu.au> writes:

  SH> On Fri, 01 Jun 2001 03:46:37 GMT, Rob <> wrote:
  >> 
  >> "Uri Guttman" <uri@sysarch.com> wrote in message
  >> news:x7n17szx1n.fsf@home.sysarch.com...

  >>> >> That is what "killfile" means.
  >>> 
  R> That is what 'threat' means.
  >>> 
  >>> poor you. you have no clue. killfiling will not directly affect you so
  >>> there is no threat. it just means you will not get help from most of the
  >>> people here.
  >> 
  >> And that is the threat.
  >> Thank you for being such a friendly person.

  SH> Strange logic...

  SH> You claim that killfiling is a threat. And yet in the same post
  SH> you also said the person should just not reply to your posts -
  SH> which is what killfiling is meant to do. No point reading if you
  SH> have no intention of replying - one way communication isn't much
  SH> fun.

  SH> Telling you that 'I will no longer see any of your posts' is
  SH> somehow a threat?

i really think he doesn't know what killfiling is. he seems to think it
is global and not individual. and he doesn't seem to want to learn about
what it means. oh, well. he will just go away soon.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: 1 Jun 2001 08:26:29 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Posting Etiquette
Message-Id: <9f7jjl$fk1$1@bob.news.rcn.net>

Rob <"relaxedrob@optushome.com.au"> wrote:

> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrn9hdv4q.7n1.tadmc@tadmc26.august.net...
>> I (and I expect, many others) will not be seeing any of your posts.
>>
>> That is what "killfile" means.
>>

> That is what 'threat' means.

The things you learn on Usenet...

In the last couple weeks, I've been participating in one group where 
someone was convicted of "threatening" a "church" for making jokes about 
targeting them with ICBMs.  I've been participating in another group where 
someone claims to be "threatened" by other men looking at his pee-pee in 
public washrooms (something that most of the other participants believe 
would only be possible with optics that NASA could only dream of).  Now I 
find that I'm participating in a third group where "threat" means "people 
won't listen to me."

Look.  "I'll inject you with anti-nausea drugs and then force you to eat
500 pounds of Spam" is a threat.  So is "I'll tie you up, stick headphones
on your head, and connect them to a CD changer set to play all the Spice
Girls' recordings on continuous loop."  But "I'm not going to volunteer to
help you if you're rude to me, or if your requests for help are needlessly
hard to read" is *not* a threat.  Period.  You have not, AFAIK, entered
into any sort of contract with Tad, or anyone else here, that would give
you a claim on his time.  Therefore you have to rely entirely on people's
generosity, and you don't do that by accompanying your requests for help 
with demands that the help be delivered only in a form exactly to your 
liking.

You are loudly complaining to the person who brought it that the potato 
salad you're bogarting isn't spicy enough.  That's not how normal people 
behave at a potluck, at least if they expect not to be asked to leave.



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

Date: Fri, 01 Jun 2001 04:45:31 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Problem with matching with variable regular expression
Message-Id: <3B171DE1.E1E1F3A2@acm.org>

Damian James wrote:
> 
> U-Save Auto Rental chose Thu, 31 May 2001 18:31:27 -0800 to say this:
> >...
> >No matter what I have in $string, it always matches to the $pattern[$i]
> >when $pattern[$i] equals to an empty string which is not good.
> >
> >Does anybody have a solution?
> >
> 
> Yes -- don't use those empty strings:
> 
>         my @patterns_to_loop_over = grep { length $_ }, @pattern;

Either braces or comma, not both

$ perl -le 'my @pattern=("one","","three","four","","six");my
@patterns=grep { length $_ }, @pattern'            
syntax error at -e line 1, near "},"
Execution of -e aborted due to compilation errors.



John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 31 May 2001 22:15:44 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Problem with matching with variable regular expression
Message-Id: <3B172500.8C5ED4A8@stomp.stomp.tokyo>

U-Save Auto Rental wrote:

(snipped)

 
> The porblem that I have is that some array elements are equal to ''
> (empty string).
 
> No matter what I have in $string, it always matches to the $pattern[$i]
> when $pattern[$i] equals to an empty string which is not good.
 
> Does anybody have a solution?


Yes, a solution. It is a good practice to post your
actual code in question rather than pseudo code. This
affords a reader an ability to look over your code,
spot other problem areas of which you may not be aware
and, importantly, affords a reader an ability to copy
your code for actual testing.

Consider posting your real code in the future. This is
thought to be polite and respectful.

You will find my test code below my signature to be a
bit more efficient than grep methodologies and, more
so with increasing array size.


Godzilla!
--

#!perl

print "Content-type: text/plain\n\n";

@Pattern = ("godzilla", "", "rocks!", "");

$godzilla = "Godzilla Rocks!";

foreach $pattern (@Pattern)
 {
  if ($pattern)
   {
    if ($godzilla =~ /$pattern/i)
     { print "She Rocks!\n"; }
   }
 }


exit;

PRINTED RESULTS
_______________

She Rocks!
She Rocks!


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

Date: Fri, 01 Jun 2001 08:48:35 GMT
From: felan_66@hotmail.com (felan)
Subject: Rename .htm to .html
Message-Id: <3b1756d3.163159762@news.uio.no>

Can any one show me a command i unix or a program i perl which
converts all the .htm extension in a given directory to .html
extensions?

tnx
felan_66@hotmail.com


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

Date: Fri, 1 Jun 2001 08:58:13 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Rename .htm to .html
Message-Id: <slrn9helkg.com.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 01 Jun 2001 08:48:35 GMT, felan <felan_66@hotmail.com> wrote:
>Can any one show me a command i unix or a program i perl which
>converts all the .htm extension in a given directory to .html
>extensions?

Unix:

for i in `ls *.htm`; do mv $i ${i}l; done

Perl:

perl -e 'rename($_, $_ . "l") for (glob("*.htm"))'

Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print print;'


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

Date: Fri, 01 Jun 2001 09:06:38 GMT
From: felan_66@hotmail.com (felan)
Subject: Re: Rename .htm to .html
Message-Id: <3b175af8.164220702@news.uio.no>

On Fri, 1 Jun 2001 08:58:13 +0000 (UTC),
bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:

>On Fri, 01 Jun 2001 08:48:35 GMT, felan <felan_66@hotmail.com> wrote:
>>Can any one show me a command i unix or a program i perl which
>>converts all the .htm extension in a given directory to .html
>>extensions?
>
>Unix:
>
>for i in `ls *.htm`; do mv $i ${i}l; done
>
>Perl:
>
>perl -e 'rename($_, $_ . "l") for (glob("*.htm"))'
>
>Cheers,
>Bernard
>--
>perl -le '$#="Just another Perl hacker,"; print print;'

AAAh stupid me. it is the other way around I would like to convert all
the .html files to .htm files
sorry about that


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

Date: Fri, 1 Jun 2001 09:13:32 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Rename .htm to .html
Message-Id: <slrn9hemh7.com.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 01 Jun 2001 09:06:38 GMT, felan <felan_66@hotmail.com> wrote:
>On Fri, 1 Jun 2001 08:58:13 +0000 (UTC),
>bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
>
>>On Fri, 01 Jun 2001 08:48:35 GMT, felan <felan_66@hotmail.com> wrote:
>>>Can any one show me a command i unix or a program i perl which
>>>converts all the .htm extension in a given directory to .html
>>>extensions?
>>
>>Unix:
>>
>>for i in `ls *.htm`; do mv $i ${i}l; done
>>
>>Perl:
>>
>>perl -e 'rename($_, $_ . "l") for (glob("*.htm"))'

[snipped quoted sig]

>AAAh stupid me. it is the other way around I would like to convert all
>the .html files to .htm files
>sorry about that

For cryin' out loud, can't you just adapt one of the solutions to your
needs!? I suggest the Perl version since it's easier.

Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print print;'



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

Date: 1 Jun 2001 05:17:25 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Rounding
Message-Id: <9f78h5$n61$2@216.155.32.28>

In article <OroR6.3240$Yr1.147296@ozemail.com.au>,
 "Ron Savage" <ron@savage.net.au> wrote:

 | Dave
 | 
 | You can't rely on Perl's 'printf' function without extreme care. According 
 | to the C language spec (yes, it's relevant), 'printf' can
 | round up or truncate depending on the magnitude of the number.
 | 
 | I didn't test Scott's sub, but I'm sure he's trying to avoid this problem.

got that right. hehe
 
 | Look carefully at the output of this (tested code):

very odd, and not at all what I would have expected without an actual 
"round" sub.

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: 1 Jun 2001 05:21:32 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Rounding
Message-Id: <9f78os$n61$3@216.155.32.28>

In article <9f54ij$12k$2@mamenchi.zrz.TU-Berlin.DE>,
 anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:

 | > You can't rely on Perl's 'printf' function without extreme care.
 | > According to the C language spec (yes, it's relevant), 'printf' can
 | > round up or truncate depending on the magnitude of the number.
 | 
 | Can you substantiate that?  In particular, I have never heard of
 | printf vacillating between rounding and truncating depending
 | on magnitude.
 | 
 | [snip]


Try running his program, Anno.. I got very specious results under 
MacPerl 5.6.1a2 and 5.004 

Similarly specious results though slightly different from the above, 
under Perl 5.005_03 
(This is perl, version 5.005_03 built for i386-freebsd)

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: 1 Jun 2001 07:30:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Rounding
Message-Id: <9f7gbb$1v$1@mamenchi.zrz.TU-Berlin.DE>

According to Scott R. Godin <webmaster@webdragon.unmunge.net>:
> In article <9f54ij$12k$2@mamenchi.zrz.TU-Berlin.DE>,
>  anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> 
>  | > You can't rely on Perl's 'printf' function without extreme care.
>  | > According to the C language spec (yes, it's relevant), 'printf' can
>  | > round up or truncate depending on the magnitude of the number.
>  | 
>  | Can you substantiate that?  In particular, I have never heard of
>  | printf vacillating between rounding and truncating depending
>  | on magnitude.
>  | 
>  | [snip]
> 
> 
> Try running his program, Anno.. I got very specious results under 
> MacPerl 5.6.1a2 and 5.004 
>
> Similarly specious results though slightly different from the above, 
> under Perl 5.005_03 
> (This is perl, version 5.005_03 built for i386-freebsd)

I have run the program and others like it[1].  The results you see
are absolutely what must be expected, different results on machines
using different number representations included.

In particular, they don't bear out your suggestion that printf
variously uses rounding and truncation.  It doesn't.  Detailed
explanations and pointers to the pertinent FAQ appear elsewhere
in this thread.

Anno

[1] Not on a Mac, admittedly.  However, I'd be amazed if printf
    behaved differently there.


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

Date: Fri, 1 Jun 2001 19:47:04 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Rounding
Message-Id: <KGIR6.348$QW4.11275@ozemail.com.au>

See below.

--
Cheers
Ron  Savage
ron@savage.net.au
http://savage.net.au/index.html

>
>  | Look carefully at the output of this (tested code):
>
> very odd, and not at all what I would have expected without an actual
> "round" sub.

1) I should of course have posted the output from my installation of Perl:

0.555 => 0.56.

1.555 => 1.55.

0.565 => 0.56.

1.565 => 1.56.

0.575 => 0.57.

1.575 => 1.58.

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 626 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 01:31:15 May  2 2001
 ...

Taking just the first 2 lines of output, you simply need to keep in mind the impossibiliy of correctly representing most
floating-point numbers in binary.

2) When I said:
>You can't rely on Perl's 'printf' function without extreme care. According to the C language spec (yes, it's relevant), 'printf'
can
>round up or truncate depending on the magnitude of the number

I was casually referring to this book:
C A Reference Manual
Harbison, Steele
Tartan, Inc
0-13-326224-3
Page 376
where it says:
"(Some C implementations do not perform correct rounding in all cases.)"

IE You have been warned.





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

Date: Thu, 31 May 2001 22:55:32 -0600
From: Jerry Coffin <jcoffin@taeus.com>
Subject: Re: The FlakeyMind/Bryce Jacobs FAQ (v0.1)
Message-Id: <MPG.1580ce11bc9aee01989c06@news.direcpc.com>

In article <3b16c876$0$328$3c090ad1@news.plethora.net>, 
seebs@plethora.net says...

[ ... ] 

> And if we didn't, you think we'd take crap like this?  Hell, no.  We'd
> crosspost to alt.religion.kibology and say things like
> 	I need to write a rendering program which can display something
> 	that looks like durian smells.  Should I use perl or python?

I don't know Peter -- I think you _should_ have responded with your 
own "infrequently asked questions" list.  If nothing else, it's a LOT 
funnier! 

-- 
    Later,
    Jerry.

The Universe is a figment of its own imagination.


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

Date: 1 Jun 2001 05:41:53 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Unsure about headers
Message-Id: <9f79v1$n61$4@216.155.32.28>

In article <UxfR6.5250$25.18979@news1.eburwd1.vic.optushome.com.au>,
 "Rob" <"relaxedrob@optushome.com.au"> wrote:

 | Hi Brian!
 | 
 | Unless the reply needs to directly quote any of the original text, the reply
 | belongs above the original text. This is much easier to understand and 
 | precludes
 | the user from having to scroll through a potentially large message to get to 
 | a
 | potentially small reply.
 | 
 | Rob

Wrong. Usenet uses THREADS, which PRECLUDE the necessity of including a 
post in the reply unless you are responding to particular points IN the 
reply, in which case your reply should be interleaved between and below 
each point you respond to. 

Top-posting is bad, and frowned upon in this group and for reasons why, 
you should refer to the following: 

   
     http://www.geocities.com/nnqweb/nquote.html
     http://www.uwasa.fi/~ts/http/quote.html
     http://www.btinternet.com/~chiba/sbox/topposters.html

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Fri, 01 Jun 2001 10:02:44 +0100
From: John Imrie <07950232225@one2one.net>
Subject: Re: Using Perl to keep track on internet usage?
Message-Id: <3B175A34.27677419@one2one.net>



Ed wrote:

> Hello group,
>
> Have been using Perl for a short while and have be asked to something I
> really am not sure where to start. My boss want to keep track of what files
> are being viewed on each PC (approx 8 PC (Win98)) on each account. Is there
> an easy way to make a program run when the puter is turned on, perferable
> without anyone knowing it is running. I thought about automatically copying
> the temp and history files but this does not seem to be a great idea.
>
> Any ideas would be appreciated.
>
> Ed

Just be verry carfull with this. In the UK and, I think, most of Europe you
would probably be in breach of various Data Protection, Privicy and Employment
Laws.



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

Date: Fri, 1 Jun 2001 11:21:38 +0200
From: Martin Mewes <mm@mamemu.de>
Subject: Re: Variablen durch Formular
Message-Id: <1999585.koFCf946Em@server.mamemu.de>

Hallo Ludmilla,

Ludmilla Markowska schrieb am Mittwoch, 30. Mai 2001 20:06:

> Hallo,
> ich bastele gerade an einem Script, mit dem man über eine Website
> u.a neue Zonendateien für einen DNS-Server anlegen kann, das Script,
> das an der Consolo gut funktioniert sieht (stark gekürzt) so aus:

Hmm, also Du hättest es nicht so stark kürzen sollen, wie soll man da 
in den Code eintauchen, wenn wichtige Teile zB fehlern ?

> #!/usr/bin/perl -w
> # adddom
> use CGI qw(:standart);

hmmm ... heißt es nicht "standard" ?

> use strict;
> # print("\n\nZONE DOMAIN anlegen\----------\n\n");
> #my $domain = domain;
> #print("DOMAIN: ");
> $domain = <STDIN>;
> chomp($domain);
> system <"touch $domain.hosts">;

Ich kenne sytem-Befehle nur in folgender Syntax:
system ("bla");

> open ZONE, ">$domain.hosts" or
> die "I can't open zonendatei";

Ein wunderbares Denglisch :-)

> print ZONE <<"EOH";
> zone \"$domain\" \{
> type master\;
> file \"\/var\/named\/$domain\"\;
> \}\;
> EOH

Hint: Mich verwirrt es ein wenig, wenn ich Master und Slave-Zonen in 
einem Verzeichnis habe. Ich bin da sehr konservativ ;-)
/var/named/master/$domain
/var/named/slave/$domain

so stelle ich das ein, aber eben nur meine 2 Pfennig.

> <form action="/cgi-bin/addzone-cgi.pl">
> <p>Bitte geben Sie den Domainnamen ein:
> <input name="domain" size="50"></p>
> <input type="submit" value="Abschicken">
> </form>
> ...
> Problem, es gibt einen "Internal Server Error".
> Kann mir jemand sagen, was ich da falsch mache?

Von der Abfolge her würde ich ein Rechteproblem suchen. Vielleicht 
darf der user "wwwrun" (oder was auch immer in der httpd.conf steht" 
nicht in jenem Verzeichnis schreiben ?

-- 
bis dahin - Martin Mewes
"Sollten Sie jedoch grundsätzlich auf einer sofortigen Stellungnahme
zu Ihrem Problem beharren, geben Sie bitte in Ihrem voicefähigen
Fernsprechnetzwerkbrowser den URL <phoneto://0815-4711> ein."


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

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


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