[15549] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2962 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 5 18:05:44 2000

Date: Fri, 5 May 2000 15:05:25 -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: <957564323-v9-i2962@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 5 May 2000     Volume: 9 Number: 2962

Today's topics:
    Re: #!/usr/bin/perl question <bogusemailaddress@bogusinternetcompany.com>
    Re: $[ causing problems down the line (Mike Mulvaney)
    Re: *** To retrieve remote files regularly? <lr@hpl.hp.com>
    Re: *** To retrieve remote files regularly? <tony_curtis32@yahoo.com>
    Re: 8i + Oraperl DBD <makarand_kulkarni@My-Deja.com>
        calling java code from perl.. <joydeep@corp.sgi.com>
    Re: calling java code from perl.. <makarand_kulkarni@My-Deja.com>
    Re: Can anyone recommend a good book <nospam@devnull.com>
        CHECKING FORM DATA FOR NUMERIC DATA linux4all@yahoo.com
    Re: CHECKING FORM DATA FOR NUMERIC DATA <sariq@texas.net>
    Re: Conditional use ? (R1CH)
        Email Attachments using OLE MAPI.Session on NT <arek@pietruszewski.com>
    Re: Email Attachments using OLE MAPI.Session on NT <eryq@zeegee.com>
    Re: error message nobull@mail.com
        gethostbyaddre: Address family not supported by protoco <s1dugan@exnet.iastate.edu>
    Re: getting started with perl on unix <lr@hpl.hp.com>
    Re: global variable with perl-cgi scripts ? <e.bras@hccnet.nl>
        Hash of hash of hash... <claes@uno.canit.se>
    Re: Help counting things with Perl <nospam@devnull.com>
    Re: Help with substitution operator. <gellyfish@gellyfish.com>
        how do I replace all html tags <szovakNOszSPAM@hotmail.com.invalid>
    Re: how do I replace all html tags <aqumsieh@hyperchip.com>
    Re: How to tell if <> operator will work on a given sca <eryq@zeegee.com>
    Re: How to tell if <> operator will work on a given sca <aqumsieh@hyperchip.com>
    Re: module data usage question <jeff@vpservices.com>
        mystery: perl -e '<>;<>' <occitan@esperanto.org>
        Need Freelance Perl Scripter <webmaster@cpudetails.com>
    Re: Need Freelance Perl Scripter <andrew.mcguire@walgreens.com>
        parsing input to confirm a valid e-mail address <nospam@devnull.com>
    Re: parsing input to confirm a valid e-mail address <lr@hpl.hp.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 5 May 2000 18:50:24 +0100
From: "anon" <bogusemailaddress@bogusinternetcompany.com>
Subject: Re: #!/usr/bin/perl question
Message-Id: <957549285.305558@zx81.mersinet.co.uk>

Many thanks for the replies.

I consider my education now complete and will offer my services as an
experienced perl programmer.

That is when they let me out !!




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

Date: Fri, 05 May 2000 20:29:55 GMT
From: mike@excite.com (Mike Mulvaney)
Subject: Re: $[ causing problems down the line
Message-Id: <slrn8h6fll.lt6.mike@zorak.milkmen>

I've done some more investigating, and now I am more confused.

Try the following changes to BadIdea.pm, either use'ing or require'ing
exporter:

$ cat BadIdea.pm
require Exporter;
$[ = 1;
1;

Now if you run it, it will print out "Works!".

Now try :
$ cat BadIdea.pm
use Exporter;
$[ = 1;
1;

Now it prints out "doesn't work!".

WTF?

Adding a 'package BadIdea' line doesn't seem to make a difference.

(I know I can fix this by using local().  but I have a lot of scripts
that use this module, and I need to know which ones rely on $[ being
1.  In order to figure that out, I need to understand why setting $[
affects other files when the docs say that it shouldn't.)

Mike

Earlier, Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov> wrote:

>
>$ cat BadIdea.pm
>$[ = 1;
>1;
>
>$ cat temp.pl
>#!/usr/bin/perl -w
>use strict;
>use BadIdea;
>my @array = ("Doesn\'t work :(\n", "Works!\n");
>print $array[1];
>
>$ temp.pl
>Doesn't work :(
>
>Fortunately, you may be able to solve it with a very simple change:
>
>$ cat BadIdea.pm
>local $[ = 1;
>1;
>
>$ temp.pl
>Works!
>
>Read 'perldoc -f local' and perlsub.
>
>Jon
>-- 
>Knowledge is that which remains when what is
>learned is forgotten. - Mr. King


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

Date: Fri, 5 May 2000 12:41:18 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: *** To retrieve remote files regularly?
Message-Id: <MPG.137cc3b8e2a471c298aa09@nntp.hpl.hp.com>

In article <3912A020.EE879E94@i-a.co.uk> on Fri, 05 May 2000 11:19:12 
+0100, Andy Jeffries <andy@i-a.co.uk> says...
> Jonathan Stowe wrote:
> > > It feels really strange answering a PHP question on a Perl newsgroup,
> > > but using PHP is easy, something like the following should do it:
> > >
> > > $myfile =
> > > fopen("ftp://username:password@mysite.com/images/downloadme.gif", "rb");
> > 
> > Ah! the light dawns - this is why people think that you can open a URL
> > in Perl just the same as a normal file.
> 
> The confusion comes from the fact that the line of code above is PHP, in
> which you can open a URL just like a normal file.

From a syntactic point of view, it could be done with Perl open() also, 
because it is easy to disambiguate a URL from a 'normal' file pathname, 
based on the 'scheme'.  (Ending a directory name with a colon, then 
using two slashes as a path separator, might be valid Unix syntax, but 
would be perverse beyond belief.)

It would require incorporating the libnet bundle into the perl core, 
i.e. integrating Perl as tightly with the external network as it is now 
with the local filesystem.

Considering the relative ages of Perl, PHP, and networking protocols, 
that might be an attractive modernization for Perl to undertake.  (No, 
I'm not volunteering!  :-)

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


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

Date: 05 May 2000 15:05:38 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: *** To retrieve remote files regularly?
Message-Id: <8766ssg3u5.fsf@shleppie.uh.edu>

>> On Fri, 5 May 2000 12:41:18 -0700,
>> Larry Rosler <lr@hpl.hp.com> said:

> In article <3912A020.EE879E94@i-a.co.uk> on Fri, 05 May
> 2000 11:19:12 +0100, Andy Jeffries <andy@i-a.co.uk>
> says...
>> Jonathan Stowe wrote: > > It feels really strange
>> answering a PHP question on a Perl newsgroup, > > but
>> using PHP is easy, something like the following should
>> do it: > > > > $myfile = > >
>> fopen("ftp://username:password@mysite.com/images/downloadme.gif",
>> "rb"); > > Ah! the light dawns - this is why people
>> think that you can open a URL > in Perl just the same
>> as a normal file.
>> 
>> The confusion comes from the fact that the line of code
>> above is PHP, in which you can open a URL just like a
>> normal file.

> From a syntactic point of view, it could be done with
> Perl open() also, because it is easy to disambiguate a
> URL from a 'normal' file pathname, based on the
> 'scheme'.  (Ending a directory name with a colon, then
> using two slashes as a path separator, might be valid
> Unix syntax, but would be perverse beyond belief.)

> It would require incorporating the libnet bundle into
> the perl core, i.e. integrating Perl as tightly with the
> external network as it is now with the local filesystem.

Just my 1.9999999 cents' worth:

The idea of tying open() and libnet seems attractive
initially, but I think the motivation rests on the
misunderstanding "a URL with a scheme like http etc. is a
*file*".  The URL http://some.where/path/to/icon.gif might
look like a filename at the end but the client can't know
what it is.  You'd have to LWP a "GET" inside open() to
find out what the return Content-Type is to then forward
the open() onto some subclass e.g. open::http() or
open::file().

I think the complications of this outweigh the surface
attraction.  Each subclass would presumably have different
semantics (e.g. rewindable or not?) and I think that might
cause too much stress on the followability of code using
it.

Catching weird yet possible situations like Larry
mentioned with relative filenames beginning "http://path/"
are highly unlikely but we all know something like this
would pop up sooner or later.

Summary: network requests for URLs and opening files on a
local filesystem are too unlike to be mapped onto the same
operation.

I could be wrong of course.
tony


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

Date: Fri, 05 May 2000 11:51:15 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: 8i + Oraperl DBD
Message-Id: <39131823.9A2681BB@My-Deja.com>

> "You need a
>  Solaris patch to run this version of java runtime".  No mention of what
> patch.

Appears that the java runtime for Oracle 8i requires some solaris
patches. There is a doc at
http://www.sbg.ac.at/docu/man/oracle/ora_815_doc/solaris.815/a67457/toc.htm

Patch mentioned..
--
Use the latest kernel patch from Sun Microsystems. Sun provides patch
information at http://sunsolve.sun.com
At least kernel jumbo patch revision #105181-06 is required for successful
installation of Release 8.1.5.
--




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

Date: Fri, 05 May 2000 11:34:17 -0700
From: Joydeep Roy Chowdhury <joydeep@corp.sgi.com>
Subject: calling java code from perl..
Message-Id: <39131429.3EA474D8@corp.sgi.com>


--------------5AF6DDA6B43A9575D44424A2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


how can we instantiate and access a Java Object from within Perl ?

the reason I need this is that I receive serialized Java object and I
need to plug the Java object to the existing perl-cgi scripts
application. any help will be greatly appreciated.

thanks.


--
Joydeep Roy Chowdhury
E-mail : joydeep@corp.sgi.com
Tel. # : (650) 933 - 6183



--------------5AF6DDA6B43A9575D44424A2
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
&nbsp;
<br>how can we instantiate and access a Java Object from within Perl ?
<p>the reason I&nbsp;need this is that I receive serialized Java object
and I need to plug the Java object to the existing perl-cgi scripts application.
any help will be greatly appreciated.
<p>thanks.
<br>&nbsp;
<pre>--&nbsp;
Joydeep Roy Chowdhury
E-mail : joydeep@corp.sgi.com
Tel. # : (650) 933 - 6183</pre>
&nbsp;</html>

--------------5AF6DDA6B43A9575D44424A2--



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

Date: Fri, 05 May 2000 12:11:02 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: calling java code from perl..
Message-Id: <39131CC6.20FAEE66@My-Deja.com>

> I receive serialized Java object and I need to plug the Java object to
> the existing perl-cgi scripts application. any help will be greatly
> appreciated.

Write a java wrapper for the existing perl cgi scripts that you have
currently.
Initialize the required java objects from the serialized stuff you are
getting.
Grab the name and value pairs from this object and then forward them to
the existing perl cgi scripts using java.net.URL classes.

--



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

Date: 5 May 2000 18:55:08 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Can anyone recommend a good book
Message-Id: <8ev5ec$qfk$1@216.155.33.10>

In article <slrn8h3gn8.2oo.tadmc@magna.metronet.com>, 
tadmc@metronet.com (Tad McClellan) wrote:


 | >After all, what unsuspecting newbie 
 |  
 | Usenet is not for unsuspecting newbies.
 | 
 | It is for members of the Usenet community.
 | 
 | It is "open" and easy to become a member. You just read some
 | of the FAQs posted regularly to   news.announce.newusers
 | and you're "in".
 | 
 | The problem is not with the newsgroup hierarchy. The problem
 | is with ISPs/sysadmins that give people access to Usenet
 | without showing them how to conduct themselves.
 | 
 | The hierarchy is fine.
 | 
 | We need a campaign to educate "service" providers who
 | promote their users beyond "kindergarten" without first
 | teaching them that the "line forms to the rear", so to speak.
 | 

truely it has been said : 

"USENET is like a herd of performing elephants with diarrhea: massive, 
difficult to redirect, awe-inspiring, entertaining, and a source of mind 
boggling amounts of excrement when you least expect it."
 [Eugene "Spaf" Spafford]

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 05 May 2000 20:45:16 GMT
From: linux4all@yahoo.com
Subject: CHECKING FORM DATA FOR NUMERIC DATA
Message-Id: <8evbso$ob6$1@nnrp1.deja.com>

With Perl, how can I check a string from a form submission to make sure
that the string contains *only* digits and zero or one period (decimal
point).  I tried using the following, but it doesn't seem to work quite
right:

# START OF CODE
if ($present_value !~ /\d*\.?\d*/)
{
     $this_error_string = "You entered bad data for a known value!";
     &ERROR_MESSAGE($this_error_string);
     exit 0;
}
# END OF CODE

The code above doesn't seem to catch even simple violations
like "12f000" etc.

I assume that by using a regular expression I'm going about this the
right way.  Please tell me if I'm way off base.

Isn't this a popular task in Perl?  That is, checking for good input
data.  Aren't there any functions or well-documented subroutines?

Any help would be greatly appreciated.

Thanks,
John
linux4all@yahoo.com


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


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

Date: Fri, 05 May 2000 16:56:56 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: CHECKING FORM DATA FOR NUMERIC DATA
Message-Id: <391343A8.F4872D88@texas.net>

linux4all@yahoo.com wrote:
> 
> With Perl, how can I check a string from a form submission to make sure
> that the string contains *only* digits and zero or one period (decimal
> point).

Please check the documentation before posting.

perldoc -q number

Then, read:

perldoc perldoc
perldoc perl

The answers to 99% of your Perl questions are as close as your
harddrive.

- Tom


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

Date: Fri, 05 May 2000 19:24:34 GMT
From: r1ch@n0sp4m.r1ch.net (R1CH)
Subject: Re: Conditional use ?
Message-Id: <39131f77.249362744@news.screaming.net>

On Wed, 03 May 2000 18:53:41 +0200, Marco Natoni <blah@nospam.com>
wrote:

>Hi Tony,
>
>Tony Curtis wrote:
>> Unfortunately that still won't work.  (Test code before posting!)
>
>  Ooops... I have pointed my attention only to the first part of the
>question! =)
>

print "Trying Time::HiRes...";
if (eval "use HiRes", $@) {$notime = 1;}
if ($notime == 1) {
  print "FAILED: module not compatible/installed on this platform\n";
} else {
  print "OK\n";
}

works fine thanks to the ppl in #perl IRC channel. Also I use $^O to
check for OS.. is this better/worse than use Config etc ?

Thanks for the replies anyway.


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

Date: Fri,  5 May 2000 14:33:11 EDT
From: Arek <arek@pietruszewski.com>
Subject: Email Attachments using OLE MAPI.Session on NT
Message-Id: <8ev457$24jk$1@earth.superlink.net>


I was wondering if anyone has knows how to add attachments to email mesg
being sent from Perl (ActiveState) created on NT using OLE MAPI.Session
Object; I am able to send a msg fine (using either Outlook or Exchange),
but I cannot figure out how to add attachment to it and/or how to
specify the location for the file being attached.  Can anyone help me
out here?  I am including pieces of code that creates and sends the
email, just to clarify the usage a little;

$MyEmailSession=CreateObject OLE "Mappi.Session" || die;
$MyEmailSession->Logon($username, $pass);
$MyMesg->$MyEmailSession->Outbox->Messages->Add();
$Recipient=$MyMesg->Recipients->Add();
 ..
 ..
$MyMesg->Update();
$MyMesg->Send(0,0,0);

I would estimate it to be something like;

$MyMesg->Attachments->Add("c:\file_name_here");

but it does not work.
I looked around a lot already, and I cannot find any examples of sending
attachments; I have tried to use VB object browser to see what
objects/methods I need to call, and I could not come up with working
solution.  Help, plz.


Arkadiusz P.





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

Date: Fri, 05 May 2000 15:48:48 -0400
From: Eryq <eryq@zeegee.com>
To: Arek <arek@pietruszewski.com>
Subject: Re: Email Attachments using OLE MAPI.Session on NT
Message-Id: <391325A0.855C891D@zeegee.com>

Arek wrote:
> 
> I was wondering if anyone has knows how to add attachments to email mesg
> being sent from Perl (ActiveState) created on NT using OLE MAPI.Session
> Object; I am able to send a msg fine (using either Outlook or Exchange),
> but I cannot figure out how to add attachment to it and/or how to
> specify the location for the file being attached.  Can anyone help me
> out here?  I am including pieces of code that creates and sends the
> email, just to clarify the usage a little;

You could try MIME::Lite, which doesn't require any of the messy
and non-portable OLE stuff.  It's just a single MIME/Lite.pm file.
Get it from the Perl page of:

	http://www.zeegee.com

Docs online at:

	http://www.zeegee.com/code/perl/MIME-Lite/docs/

HTH,

Eryq


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

Date: 05 May 2000 18:51:17 +0100
From: nobull@mail.com
Subject: Re: error message
Message-Id: <u94s8cnawa.fsf@wcl-l.bham.ac.uk>

"Johnny Boy" <johnnylee@totalise.co.uk> writes:

> Subject: error message

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> I am running (trying to really) run a file upload script using
> cgi.pm.

What is cgi.pm? I keep seeing references to it.  I see them so often
that I'm beginning to suspect that there may really be a cgi.pm (as
distinct from CGI.pm).

>  When
> I run the script I am getting a
> malformed multipart post error that I haven't got a clue how to handle.
> Could some nice soul tell me what the error means

Which word don't you understand:

malformed - badly or incorrectly formed.  Not right.  Broken.

multipart - this is referrs to the MIME content type
             "multipart/form-data".

post - the HTTP method used by a client to send the server addition
       information (as a message body) about the request in addition
       to the URL.

> and how to correct it?

Well, if you believe the error then your HTTP client is broken - so
this has nothing to do with Perl.

If the client isn't broken the the module is.  Unless you have good
knowledge of Perl, HTTP and CGI then probably you don't correct it.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 5 May 2000 16:47:13 -0500
From: "Darin Dugan" <s1dugan@exnet.iastate.edu>
Subject: gethostbyaddre: Address family not supported by protocol
Message-Id: <8evfh1$jl3$1@news.iastate.edu>

Can anyone point out what could be wrong with my setup here?

perl -e 'use Socket; $name = gethostbyaddr(inet_aton(129.186.107.10),
AF_INET) || die "Dying: $!"; print "\n$name\n";'
Dying: Address family not supported by protocol at -e line 1.

#uname -a
Linux www 2.2.13 #7 Tue Apr 4 09:33:39 CDT 2000 i686 unknown

#perl -v
This is perl, v5.6.0 built for i686-linux

--
Darin Dugan
s1dugan(at)exnet(dot)iastate(dot)edu




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

Date: Fri, 5 May 2000 13:40:10 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: getting started with perl on unix
Message-Id: <MPG.137cd1822c46780a98aa0b@nntp.hpl.hp.com>

In article <3912c87b.44351284@news.primenet.com> on Fri, 05 May 2000 
13:14:33 GMT, David Knapik <dknapik@primenet.com> says...
> So can you execute perl?
> $perl
> 
> If you  have sufficient privilages it should give you a blank line.
> (^C to exit).

Assuming that '$' is a command prompt.  A better first test is

  $perl -v

because you should see the version information, not just nothing.

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


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

Date: Fri, 5 May 2000 22:09:19 +0200
From: "Ed Bras" <e.bras@hccnet.nl>
Subject: Re: global variable with perl-cgi scripts ?
Message-Id: <8eva6k$qfl$1@news.hccnet.nl>

Dear Tina,

It's a good idea, thanks, but what about session depend variables ?
That is that one person can change the variable value of another when they
both have web connection with the same page. Do you have  a solution for
that ?
Normaly thay store this kind of information in the page itself, but I was
wondering if a kind of ASP soluting is posible where they use the session
object to store this kind of info.

Regards,

Ed Bras

Tina Mueller <tina@streetmail.com> wrote in message
news:8enjf2$9ebfv$1@fu-berlin.de...
> hi,
>
> Ed Bras wrote:
> >
> > Helllu, can someone tell me a good way to define your global variables,
such
> > that they still exists when the perl-cgi-script is called again ?
(without
> > using any perl-apache module).
> >
> > For example would it be possible to include a package with variables
> > defined, such that the variables in the packet still exist after the
script
> > finish running ?
>
> just store the values in a file.
> you can easily do that with the
> Tie modules, such as Tie::Hash for example.
>
> tina
>
> --
>         tinamue@gmx.net             |     _   enter the
> http://user.berlin.de/~tina.mueller |  __| |___  ___ _ _ ___
> --   new: tina's moviedatabase    --| / _` / _ \/ _ \ '_(_-< of
> --search & add comments or reviews--| \__,_\___/\___/_| /__/ perception




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

Date: 5 May 2000 21:45:06 GMT
From: Claes Bjorklund <claes@uno.canit.se>
Subject: Hash of hash of hash...
Message-Id: <8evfd2$4fn$1@dos.canit.se>

Hi

Some problems makes me crazy this is one

I would like to do this for an unknown dimmension 
(eg: dim five)

this is for dim two

while (<>) {
  @a=split;
  $var{$a[0]}{$a[1]}++;
  $var{$a[0]}{'tot'}++;
  $var{'tot'}{$a[1]}++;
  $var{'tot'}{'tot'}++;
} 

Now I have ugly routine which generate the code and then 
make an eval
any ideas?

next problem is to print the hash in a html table  

Thanks in advanced

\Claes

-- 


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

Date: 5 May 2000 18:50:50 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Help counting things with Perl
Message-Id: <8ev56a$qfk$0@216.155.33.10>

In article <3911A3C5.E2898ADC@epl.org>, Edward Wigg <ew@epl.org> wrote:

 | > Have the appropriate amount of fun!  (The Larry)
 | 
 | Knowing just how much fun is appropriate in any given situation is true wisdom.

push(@taglines, $humorous_quote);

:)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 5 May 2000 20:00:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help with substitution operator.
Message-Id: <8ev5p1$ell$1@orpheus.gellyfish.com>

On Tue, 2 May 2000 23:32:03 -0400 Tad McClellan wrote:
> On Wed, 03 May 2000 01:30:04 GMT, Krasimir Christozov <krasi77@yahoo.com> wrote:
>>Dan Burch wrote:
>>> 
>>> The problem is commas in numbers over 1000 like 1,000.
> 
>>> I tried :
>>> 
>>>   foreach $data_line ( @data_line )
>>> {
>>>     $data_line = s/,//;
>                   ^
>                   ^ you have the wrong operator there
> 
> 
>>. And any string that contains a character which is not a digit or 
>>dot is evaluated as 0 when being converted to a number.
> 
> 
> No it isn't. 
> 
> I wonder where you even got such a "rule", as it is not
> very close to the real rule at all...
> 
> Here are 5 (including "1,000") that follow your description,
> yet do NOT evaluate to zero when used as a number:
> 

But '1,000' *could* be evaluated properly in numeric context rather than
as 1 I guess .

/J\
-- 
I'm not a bad guy! I work hard, and I love my kids. So why should I
spend half my Sunday hearing about how I'm going to Hell?
-- 
fortune oscar homer


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

Date: Fri, 05 May 2000 14:43:25 -0700
From: skye <szovakNOszSPAM@hotmail.com.invalid>
Subject: how do I replace all html tags
Message-Id: <0626cae0.187ad141@usw-ex0110-076.remarq.com>

I want to remove everything between the carrots denoting an
HTML tag.  I tired using:

$line =~ s/<(*)>/ /g;

The command would take the variable line and replace
anything found between two carrots with a space.  This
didn't work and I was wondering it anyone had any ideas of
how to remove all HMTL tags while leaving all other text
behind.

Any help would be greatly appriciated!  Thanks!
Skye



* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful


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

Date: Fri, 05 May 2000 21:25:47 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: how do I replace all html tags
Message-Id: <7a7ld84rky.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


skye <szovakNOszSPAM@hotmail.com.invalid> writes:

> I want to remove everything between the carrots denoting an
> HTML tag.  I tired using:
> 
> $line =~ s/<(*)>/ /g;

	$line =~ s/<[^>]+>/< >/g;

But you are re-inventing the wheel. Look into the CGI.pm module.

You should also read more on regexps. Type 'perldoc perlre' on a command
line for more info.

--Ala


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

Date: Fri, 05 May 2000 15:45:08 -0400
From: Eryq <eryq@zeegee.com>
Subject: Re: How to tell if <> operator will work on a given scalar?
Message-Id: <391324C4.E6636F2A@zeegee.com>

Bart Lateur wrote:
> 
> Eryq wrote:
> 
> >Suppose someone gives me $fh, and I want to know
> >whether or not
> >
> >       <$fh>
> >
> >will be a problem.... *without* actually executing it.
> >I.e.: is $fh a real or tied filehandle?
> 
> Look up "fileno" in perlfunc. It might just do what you want.

Hmmmm.... I wonder then... it is *always* true that <$foo>
will work if fileno($foo) is defined?  In this uncertain 
age of tiehandle, I find myself just a wee bit unsure....

E'q


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

Date: Fri, 05 May 2000 21:13:28 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: How to tell if <> operator will work on a given scalar?
Message-Id: <7aaei44s5h.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


Eryq <eryq@zeegee.com> writes:

> Suppose someone gives me $fh, and I want to know
> whether or not 
> 
> 	<$fh> 
> 
> will be a problem.... *without* actually executing it.  
> I.e.: is $fh a real or tied filehandle?

If $fh is a tied filehandle, then ref() will return the package it has
been blessed into.

	% perl -Mstrict -wl
	use IO::File;
	my $fh = new IO::File ">/tmp/foo" or die $!;

	print ref $fh;

	__END__
	IO::File

But I don't think there is a way to check whether the filehandle is open
for read/write/etc ...

--Ala


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

Date: Fri, 05 May 2000 11:16:42 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: module data usage question
Message-Id: <3913100A.95F41AF7@vpservices.com>

phukit@enteract.com wrote:
> 
> [snippage]
> 
> In each script, I'll have a little configuration hash that contains
> information that one of the subroutines in the module will need to do
> its task properly.  The applicable parts of my script look like this:
> 
> use Mymodule;
> 
> my(%config) = (
>     'server'    => "my.server.name.com",
>     'user'      => "username",
>     'password'  => "password",
>     'db'        => "database",
>     'table'     => "table",
>     <snip several more configuration parameters>
> );
> 
> my($dbh) = &Mymodule::DatabaseConnect();
> 
> package Mymodule;
> ...
> sub DatabaseConnect {
> ...
> Now my question is this: How can I make the hash that I've defined in
> my script available to the subroutine in the module?
> ...
> I know I could just pass the subroutine a list of configuration parameters
> into its @_ when I call it, but this is a very large list of parameters and
> would be a major pain to do.

I think what you need to find out about is references (perldoc
perlref).  

Here's how it would look passing a reference to a hash rather than a
hash:

my %config = ( ... same as above ... ); 
my($dbh) = &Mymodule::DatabaseConnect(\%config);  # note backslash
 
package Mymodule;
# ...
sub DatabaseConnect {
   my %config = %{$_[0]}; # this derefernces the reference
   print $config{user}    # prints whatever you defined user 
                          # as in the hash in your main module
# ...
}

-- 
Jeff


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

Date: Fri, 05 May 2000 21:42:25 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: mystery: perl -e '<>;<>'
Message-Id: <8evf7u$s72$1@nnrp1.deja.com>

Hi!

when I execute the above programme it waits for two lines of input, at
least a newline each.  Now, when I close the file by typing ^D, on the
first <>, it sure enough returns the empty string.  But the second <>
again manages to read on that filehandle, even though it had already
reached eof!

How can this be?  Does Perl somehow reopen the filehandle, or at least
reset its eof-reached-state?

This happens both with 5.004 and 5.005, both on Siemens Reliant Unix and
Linux.

perplex -- Daniel

--
Bring text-docs to life!              Erwecke Textdokumente zum Leben!
                   http://beam.to/iPerl/
Vivigu tekstodokumentojn!


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


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

Date: Fri, 05 May 2000 18:08:18 GMT
From: Dave Lambrix <webmaster@cpudetails.com>
Subject: Need Freelance Perl Scripter
Message-Id: <8ev2m4$dpe$1@nnrp1.deja.com>



I am in need of a freelancer to do some Perl scripting for me. I'm
pressed for time on this project, so I need replies as soon as
possible. Please send contact information to webmaster@cpudetails.com
and I will follow up with project details and requirements.

Thanks!

~ D


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


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

Date: Fri, 05 May 2000 13:41:47 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: Need Freelance Perl Scripter
Message-Id: <391315EB.C2BE7801@walgreens.com>

Dave Lambrix wrote:
> 
> I am in need of a freelancer to do some Perl scripting for me. I'm
> pressed for time on this project, so I need replies as soon as
> possible. Please send contact information to webmaster@cpudetails.com
> and I will follow up with project details and requirements.

So, let's summarize:

I need your help to write my program for me.  You had better
hurry, because my homework is due tomorrow.  I posted this
here, but am too lazy to check for follow-ups, so please waste
your time and mail them to me, and I will tell you what you
need to do. ;^)

I realize this is not what you mean, but many here will interpret
it as that.  

Regards,

anm
-- 
Andrew N. McGuire
andrew.mcguire@walgreens.com


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

Date: 5 May 2000 19:27:57 GMT
From: The WebDragon <nospam@devnull.com>
Subject: parsing input to confirm a valid e-mail address
Message-Id: <8ev7bt$qfk$2@216.155.33.10>

is there a way to 

simple: 
 . confirm that an e-mail address entered is in fact a simple e-mail 
address (and doesn't contain 'funny' chars or multiple '@'s), and if 
not, set the variable to an error message like "!!Invalid E-mail 
Address!!"

complex:
 . verify that selfsame e-mail address is a *valid* one, i.e. stands the 
chance of actually existing as a working address. 

?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 5 May 2000 14:03:42 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: parsing input to confirm a valid e-mail address
Message-Id: <MPG.137cd7086b25209398aa0d@nntp.hpl.hp.com>

In article <8ev7bt$qfk$2@216.155.33.10> on 5 May 2000 19:27:57 GMT, The 
WebDragon <nospam@devnull.com> says...
> is there a way to 
> 
> simple: 
>  . confirm that an e-mail address entered is in fact a simple e-mail 
> address (and doesn't contain 'funny' chars or multiple '@'s), and if 
> not, set the variable to an error message like "!!Invalid E-mail 
> Address!!"
> 
> complex:
>  . verify that selfsame e-mail address is a *valid* one, i.e. stands the 
> chance of actually existing as a working address. 

perlfaq9: "How do I check a valid mail address?"

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


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

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


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