[17194] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4606 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 13 11:10:37 2000

Date: Fri, 13 Oct 2000 08:10:18 -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: <971449818-v9-i4606@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 13 Oct 2000     Volume: 9 Number: 4606

Today's topics:
        Make a new directory in perl? (Steve)
    Re: Make a new directory in perl? <tony_curtis32@yahoo.com>
    Re: Make a new directory in perl? <eric.kort@vai.org>
    Re: Make a new directory in perl? (Steve)
    Re: Make a new directory in perl? <tony_curtis32@yahoo.com>
    Re: Make a new directory in perl? <eric.kort@vai.org>
    Re: Make a new directory in perl? (Steve)
    Re: Make a new directory in perl? <tony_curtis32@yahoo.com>
        Maximum file size? <berube@odyssee.net>
    Re: Maximum file size? (Rafael Garcia-Suarez)
        Newbie needs advice <pfritz@almoninc.com>
    Re: Newbie needs advice <anders@wall.alweb.dk>
        Newbie Q: LWP $results split into an array? <davesisk@ipass.net>
    Re: Newbie Q: LWP $results split into an array? <mbudash@sonic.net>
    Re: Newbie Q: LWP $results split into an array? <davesisk@ipass.net>
    Re: Newbie Q: LWP $results split into an array? (Gary O'Keefe)
        newbie questions <dlorre@caramail.com>
    Re: newbie questions <anders@wall.alweb.dk>
        Overriding input/output files <adinh@att.com>
    Re: Overriding input/output files <eric.kort@vai.org>
        Perl conditional functions (Liam)
    Re: Perl conditional functions <eric.kort@vai.org>
    Re: Perl conditional functions <anders@wall.alweb.dk>
    Re: Perl conditional functions <zakazan@gmx.de>
    Re: Perl conditional functions (Liam)
    Re: Perl rules - Pyhton drools <james@NOSPAM.demon.co.uk>
        Please Please Help qureshii@my-deja.com
    Re: pushing an array of records <awright@jwac.osis.gov>
        system() & ENV{PATH} Problem <RichardWagner@gmx.net>
    Re: system() & ENV{PATH} Problem <kistler@gmx.net>
        Urgent Help wanted with text processing qureshii@my-deja.com
    Re: Urgent Help wanted with text processing (Bernard El-Hagin)
    Re: Urgent Help wanted with text processing qureshii@my-deja.com
    Re: Urgent Help wanted with text processing qureshii@my-deja.com
    Re: Urgent Help wanted with text processing (Bernard El-Hagin)
    Re: Urgent Help wanted with text processing (Clay Irving)
    Re: Weekday at a date <sb@muccpu1.muc.sdm.de>
    Re: which perl modules are installed by deafult if any? <anders@wall.alweb.dk>
        Win32-API.zip martinsegersten@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 13 Oct 2000 13:15:34 GMT
From: steve@nospam.* (Steve)
Subject: Make a new directory in perl?
Message-Id: <39e70ab4.18088502@news.redhotant.com>

Could anyone suggest the best way to make a new directory
using perl ?

Steve


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

Date: 13 Oct 2000 08:18:17 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Make a new directory in perl?
Message-Id: <87n1g8282u.fsf@limey.hpcc.uh.edu>

>> On Fri, 13 Oct 2000 13:15:34 GMT,
>> steve@nospam.* (Steve) said:

> Could anyone suggest the best way to make a new
> directory using perl ?

The obvious way! :-)

    perldoc -f mkdir

(Question: did you expect perl not to do it this way?  If
so, why not?)

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Fri, 13 Oct 2000 09:18:22 -0400
From: "Eric" <eric.kort@vai.org>
Subject: Re: Make a new directory in perl?
Message-Id: <8s71u9$1p4l$1@msunews.cl.msu.edu>

"Steve" <steve@nospam.*> wrote in message
news:39e70ab4.18088502@news.redhotant.com...
> Could anyone suggest the best way to make a new directory
> using perl ?
>
> Steve

mkdir("newdirect", 0777) || die "rats, couldn't make that directory: $!";

hth,
Eric




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

Date: Fri, 13 Oct 2000 13:30:07 GMT
From: steve@nospam.* (Steve)
Subject: Re: Make a new directory in perl?
Message-Id: <39e80e0b.18943727@news.redhotant.com>

On Fri, 13 Oct 2000 09:18:22 -0400

>"Steve" <steve@nospam.*> wrote in message
>news:39e70ab4.18088502@news.redhotant.com...
>> Could anyone suggest the best way to make a new directory
>> using perl ?
>>
>> Steve
>
>mkdir("newdirect", 0777) || die "rats, couldn't make that directory: $!";

Sadly, the mkdir is not working. Anyone know likely cause? 

Steve



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

Date: 13 Oct 2000 08:34:44 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Make a new directory in perl?
Message-Id: <87k8bc27bf.fsf@limey.hpcc.uh.edu>

>> On Fri, 13 Oct 2000 13:30:07 GMT,
>> steve@nospam.* (Steve) said:

> On Fri, 13 Oct 2000 09:18:22 -0400
>> "Steve" <steve@nospam.*> wrote in message
>> news:39e70ab4.18088502@news.redhotant.com...  Could
>> anyone suggest the best way to make a new directory
>> using perl ?
>>> 
>> Steve
>>  mkdir("newdirect", 0777) || die "rats, couldn't make
>> that directory: $!";

> Sadly, the mkdir is not working. Anyone know likely
> cause?

So what did the error message ($!) say?

[ forgive me, but this is beginning to smell of a troll ]

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Fri, 13 Oct 2000 09:34:44 -0400
From: "Eric" <eric.kort@vai.org>
Subject: Re: Make a new directory in perl?
Message-Id: <8s72sv$1rdo$1@msunews.cl.msu.edu>

"Steve" <steve@nospam.*> wrote in message
news:39e80e0b.18943727@news.redhotant.com...

> >mkdir("newdirect", 0777) || die "rats, couldn't make that directory: $!";
>
> Sadly, the mkdir is not working. Anyone know likely cause?
>

What error are you getting?  (Likely cause would be you don't have
permissions to mkdir where you are trying to mkdir).

Eric




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

Date: Fri, 13 Oct 2000 13:45:28 GMT
From: steve@nospam.* (Steve)
Subject: Re: Make a new directory in perl?
Message-Id: <39e91190.19845099@news.redhotant.com>

On 13 Oct 2000 08:34:44 -0500

>>> On Fri, 13 Oct 2000 13:30:07 GMT,
>>> steve@nospam.* (Steve) said:
>
>So what did the error message ($!) say?
Nothing.
>[ forgive me, but this is beginning to smell of a troll ]

Nope, what it was (just phoned host) is a security
measure. They have now some how enabled 
me to do this. Works ok now.

Cheers,

Steve




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

Date: 13 Oct 2000 08:48:47 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Make a new directory in perl?
Message-Id: <87hf6g26o0.fsf@limey.hpcc.uh.edu>

>> On Fri, 13 Oct 2000 13:45:28 GMT,
>> steve@nospam.* (Steve) said:

> On 13 Oct 2000 08:34:44 -0500
>>>> On Fri, 13 Oct 2000 13:30:07 GMT, steve@nospam.*
>>>> (Steve) said:
>>  So what did the error message ($!) say?
> Nothing.
>> [ forgive me, but this is beginning to smell of a troll
>> ]

> Nope, what it was (just phoned host) is a security
                                 ^^^^
> measure. They have now some how enabled me to do
> this. Works ok now.

So this is really a CGI question then?

If so, saying that it is a CGI problem would probably have
pin-pointed the solution in one step, i.e. some kind of
file permissions.

hth
t
-- 
Eih bennek, eih blavek.


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

Date: Fri, 13 Oct 2000 08:39:29 -0400
From: "Neb" <berube@odyssee.net>
Subject: Maximum file size?
Message-Id: <alDF5.1$eO1.454@news.globetrotter.net>

Hi,

I have a web site where I store all my members in a flat file (no DB).
Everytime a new user become a member, I add his information in the file by
reading all the file content in memory, make sure he doesn't exist yet, and
then store all content back on disk.  When the user logs in, I read all file
in memory, and make sure he is a real member.  So far, the file size is of
90 KB and the time to read in memory and write on disk the file content is
fast.

My question: is there a maximum size where I will start to see some problems
using this method?  Is 1 Meg file size start to be a problem ?

Thanks,

neb





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

Date: Fri, 13 Oct 2000 13:19:06 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Maximum file size?
Message-Id: <slrn8ue3be.4tb.rgarciasuarez@rafael.kazibao.net>

Neb wrote in comp.lang.perl.misc:
>Hi,
>
>I have a web site where I store all my members in a flat file (no DB).
>Everytime a new user become a member, I add his information in the file by
>reading all the file content in memory, make sure he doesn't exist yet, and
>then store all content back on disk.  When the user logs in, I read all file
>in memory, and make sure he is a real member.  So far, the file size is of
>90 KB and the time to read in memory and write on disk the file content is
>fast.
>
>My question: is there a maximum size where I will start to see some problems
>using this method?  Is 1 Meg file size start to be a problem ?

This is not a good idea to store such data in files. 90 kB is large
enough and you should upgrade now to a DB.

Advantages of a DB :
  - much faster access.
  - concurrent access (with your current method, if two processes want
    to open the file for writing at the same time, one will be locked
    out, waiting for the other to complete).
  - ability to store much complex information when your site will evolve

If you really don't want to (or if you cannot) use a DB, at least
rewrite your scripts so that they don't load the whole file in memory.

A good DB for your purpose might be MySQL (http://www.mysql.com/), which
is free software.

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Fri, 13 Oct 2000 07:56:08 -0500
From: "Peter Fritz" <pfritz@almoninc.com>
Subject: Newbie needs advice
Message-Id: <39e7057e$0$56649$392904a7@news.execpc.com>

I have been looking into putting a snowplow catalog online for a customer,
and had been thinking of databasing the info.  Through another newsgroup, it
was suggested that I look into a Perl script that reads .csv files.
Here's my problem....I have no experience with Perl, and need advice as to
how to go about doing this type of thing , or even just learning enough
about Perl to get a start.

I appreciate any help you can give,
Pete Fritz
pfritz@almoninc.com





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

Date: Fri, 13 Oct 2000 16:41:14 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Newbie needs advice
Message-Id: <2bFF5.442$Tq1.31897@news010.worldonline.dk>

Peter Fritz wrote:

> I have been looking into putting a snowplow catalog online for a customer,
> and had been thinking of databasing the info.  Through another newsgroup,
> it was suggested that I look into a Perl script that reads .csv files.
> Here's my problem....I have no experience with Perl, and need advice as to
> how to go about doing this type of thing , or even just learning enough
> about Perl to get a start.
> 
> I appreciate any help you can give,
> Pete Fritz
> pfritz@almoninc.com

Download and install perl

open a terminal (known as "DOS prompt" in M$ OS'es) and type "perldoc perl" 
and start reading

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Fri, 13 Oct 2000 13:03:52 GMT
From: "David Sisk" <davesisk@ipass.net>
Subject: Newbie Q: LWP $results split into an array?
Message-Id: <YKDF5.32277$oA2.5156770@typhoon.southeast.rr.com>

Hi:  I having difficulty getting this to work (using LWP and CGI modules).
Essentially, $text contains a fairly large set of data that is comma
seperated.  I want to split the data so that I have each "field" in one
element of an array.  This snippet of code to fails on the last line.  What
am I doing wrong?  Please post or email?

     my $request = POST 'http://quote.cboe.com/QuoteTable.dat',
                [ TICKER => $ticker ];

      my $result = $ua->request($request);
      $text = $result->as_string;
      @result = split(/,/$text);


Regards,
Dave





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

Date: Fri, 13 Oct 2000 07:18:23 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Newbie Q: LWP $results split into an array?
Message-Id: <mbudash-498B72.07182313102000@news.pacbell.net>

In article <YKDF5.32277$oA2.5156770@typhoon.southeast.rr.com>, "David 
Sisk" <davesisk@ipass.net> wrote:

> Hi:  I having difficulty getting this to work (using LWP and CGI 
> modules).
> Essentially, $text contains a fairly large set of data that is comma
> seperated.  I want to split the data so that I have each "field" in one
> element of an array.  This snippet of code to fails on the last line.  
> What
> am I doing wrong?  Please post or email?
> 
>      my $request = POST 'http://quote.cboe.com/QuoteTable.dat',
>                 [ TICKER => $ticker ];
> 
>       my $result = $ua->request($request);
>       $text = $result->as_string;
>       @result = split(/,/$text);
> 

@result = split(/,/,$text); # note comma before '$text'

hth (really)
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: Fri, 13 Oct 2000 14:47:07 GMT
From: "David Sisk" <davesisk@ipass.net>
Subject: Re: Newbie Q: LWP $results split into an array?
Message-Id: <LfFF5.32290$oA2.5199582@typhoon.southeast.rr.com>

Duh!  Thanks!

Michael Budash <mbudash@sonic.net> wrote in message
news:mbudash-498B72.07182313102000@news.pacbell.net...
> In article <YKDF5.32277$oA2.5156770@typhoon.southeast.rr.com>, "David
> Sisk" <davesisk@ipass.net> wrote:
>
> > Hi:  I having difficulty getting this to work (using LWP and CGI
> > modules).
> > Essentially, $text contains a fairly large set of data that is comma
> > seperated.  I want to split the data so that I have each "field" in one
> > element of an array.  This snippet of code to fails on the last line.
> > What
> > am I doing wrong?  Please post or email?
> >
> >      my $request = POST 'http://quote.cboe.com/QuoteTable.dat',
> >                 [ TICKER => $ticker ];
> >
> >       my $result = $ua->request($request);
> >       $text = $result->as_string;
> >       @result = split(/,/$text);
> >
>
> @result = split(/,/,$text); # note comma before '$text'
>
> hth (really)
> --
> Michael Budash ~~~~~~~~~~ mbudash@sonic.net




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

Date: Fri, 13 Oct 2000 14:50:14 GMT
From: gokeefe@gssec.bt.co.uk (Gary O'Keefe)
Subject: Re: Newbie Q: LWP $results split into an array?
Message-Id: <39e71ca7.22815997@news.gssec.bt.co.uk>

On Fri, 13 Oct 2000 13:03:52 GMT, "David Sisk" <davesisk@ipass.net>
wrote:


>      @result = split(/,/$text);
                         ^^^
       @result = split( /,/, $text );

You have to separate the parameters. You could drop the regex too and
just write it as

       @result = split( ',', $text );

Gary
--
Gary O'Keefe
gary@onegoodidea.com
+44 (0) 7976 614 336


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

Date: Fri, 13 Oct 2000 13:26:31 GMT
From: Dominique Lorre <dlorre@caramail.com>
Subject: newbie questions
Message-Id: <8s72i0$hmt$1@nnrp1.deja.com>

A friend of mine told me he had to get the titles from html files and
was doing it in Pascal. I told him it was a typical Perl problem and
since i am learning Perl i tried to do it (i am learning html too).
Actually, I suppose he was mentioning the title= strings in html files
instead of <TITLE> tags, so his problem is simpler but anyway it was a
good practice exercise ;).
The code works just fine (well... it seems so) but I would like to know
if there are better ways to do it, and also since I used flex and bison
in the past, if these tools have any equivalent for Perl (you put the
rules and you have Perl output generated).
TIA

<-------------The program ------------------>

#!/usr/bin/perl -w

$HTMLFILE = "./title.html" ;

open HTMLFILE or die "could not open file : $!" ;

$true = 1 ;
$false = 0 ;

$title = "" ;
$extract = $false ;

while (<HTMLFILE>)
{
    if (/<TITLE>/i) {
	$extract = $true ;
    }
    if ($extract) {
	s/\n/ / ;         # Lynx converts \n to space
	$title .= $_ ;
    }
    if ($extract && /<\/TITLE>/i) {
	$extract = $false ;
	$title =~ s/.*?<TITLE>//i ;
	$title =~ s/<\/TITLE>.*//i ;
	print $title, "\n" ;
    }
}
<----------- the test file ----------------->
<HTML>
<HEAD><TITLe>This is
a
test.</TITlE></HEAD>
<BODY>
Hello,
World!
</BODY>
<HTML>
<------------------------------------------->




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


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

Date: Fri, 13 Oct 2000 16:59:45 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: newbie questions
Message-Id: <qsFF5.451$Tq1.32535@news010.worldonline.dk>

Dominique Lorre wrote:

> A friend of mine told me he had to get the titles from html files and
> was doing it in Pascal. I told him it was a typical Perl problem and
> since i am learning Perl i tried to do it (i am learning html too).
> Actually, I suppose he was mentioning the title= strings in html files
> instead of <TITLE> tags, so his problem is simpler but anyway it was a
> good practice exercise ;).
> The code works just fine (well... it seems so) but I would like to know
> if there are better ways to do it, and also since I used flex and bison
> in the past, if these tools have any equivalent for Perl (you put the
> rules and you have Perl output generated).
> TIA
> 
> <-------------The program ------------------>
> 
> #!/usr/bin/perl -w
> 
> $HTMLFILE = "./title.html" ;
> 
> open HTMLFILE or die "could not open file : $!" ;
> 
> $true = 1 ;
> $false = 0 ;
> 
> $title = "" ;
> $extract = $false ;
> 
> while (<HTMLFILE>)
> {
>     if (/<TITLE>/i) {
> $extract = $true ;
>     }
>     if ($extract) {
> s/\n/ / ;         # Lynx converts \n to space
> $title .= $_ ;
>     }
>     if ($extract && /<\/TITLE>/i) {
> $extract = $false ;
> $title =~ s/.*?<TITLE>//i ;
> $title =~ s/<\/TITLE>.*//i ;
> print $title, "\n" ;
>     }
> }
> <----------- the test file ----------------->
> <HTML>
> <HEAD><TITLe>This is
> a
> test.</TITlE></HEAD>
> <BODY>
> Hello,
> World!
> </BODY>
> <HTML>
> <------------------------------------------->

You need to read perlre!!

die "file unexisting or unreadable" unless (-f $file && -r $file);
undef $/; #undef the record separator, a definate don't :-o
open FILE, $file or die "Berious sug: $!\n";
$file = <FILE>; # swallow entire file since $/ is undef.
close FILE or die "Even worse: $!\n";

$file =~ m/<title>([^<]*)/i;
($title = $1) =~ s/[\s\n]+/ /g;

print ($title? "Aaand the title is: $title\n" : "No title :-((\n";

-anders

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Fri, 13 Oct 2000 09:20:15 -0500
From: "Alex Dinh" <adinh@att.com>
Subject: Overriding input/output files
Message-Id: <8s7550$58d2@kcweb01.netnews.att.com>

I'm new to Perl programming, so forgive me if this sounds off the wall.

What I'm trying to do is test a Perl program and have the input files use
the files in my subdirectory instead of what's currently being specified
within the program.  Is there a way to do this at the command level (such as
some kind of parameters) without having to actually change the
specifications within the program??

Please send any suggestions to mikejfox@ticnet.com or post it here since
I'll be checking back.

Thanks.




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

Date: Fri, 13 Oct 2000 10:49:10 -0400
From: "Eric" <eric.kort@vai.org>
Subject: Re: Overriding input/output files
Message-Id: <8s778h$25fu$1@msunews.cl.msu.edu>

"Alex Dinh" <adinh@att.com> wrote in message
news:8s7550$58d2@kcweb01.netnews.att.com...
> I'm new to Perl programming, so forgive me if this sounds off the wall.
>
> What I'm trying to do is test a Perl program and have the input files use
> the files in my subdirectory instead of what's currently being specified
> within the program.  Is there a way to do this at the command level (such
as
> some kind of parameters) without having to actually change the
> specifications within the program??
>

Well, one possibility is to have the program check for files specified at
the command line, and then revert to default if it doesn't find any. For
example:

$file = $ARGV[0] || "default.txt";

Then you can enter your test files on the command line. Later, when testing
is done, just don't enter the files on the command line and the standard
files will be used ("default.txt" in the example above).

hth

Eric






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

Date: Fri, 13 Oct 2000 14:28:48 GMT
From: lkenny@fisheries.org (Liam)
Subject: Perl conditional functions
Message-Id: <39e71891.8389967@news.volocom.net>

I have having a little trouble with a form I am writing.  I know that
is also a CGI issue, but I think the problem I have is with Perl.

In my conditional statement I want any of the variables with the value
of '0' to be disregarded from the rest of the program.
But I am not sure how to do this.  Is it possible to find out which
have the value of zero and remove them?

Any and all help offered is greatly appreciated.


if ($FORM{$name} == 0) {
                    # what goes here to get those variables equal to 0

	out of the next step of my processing?
            }

LK




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

Date: Fri, 13 Oct 2000 10:40:07 -0400
From: "Eric" <eric.kort@vai.org>
Subject: Re: Perl conditional functions
Message-Id: <8s76ni$242t$1@msunews.cl.msu.edu>

"Liam" <lkenny@fisheries.org> wrote in message
news:<39e71891.8389967@news.volocom.net>...

> if ($FORM{$name} == 0) {

> # what goes here to get those variables equal to 0

>

> out of the next step of my processing?

> }

How about:

if ($FORM{$name} != 0) {


   # whatever you want to do with the values _not_ equal to zero

}

hth

Eric





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

Date: Fri, 13 Oct 2000 16:45:31 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Perl conditional functions
Message-Id: <4fFF5.439$Uy5.30031@news000.worldonline.dk>

Liam wrote:

> I have having a little trouble with a form I am writing.  I know that
> is also a CGI issue, but I think the problem I have is with Perl.
> 
> In my conditional statement I want any of the variables with the value
> of '0' to be disregarded from the rest of the program.
> But I am not sure how to do this.  Is it possible to find out which
> have the value of zero and remove them?
> 
> Any and all help offered is greatly appreciated.
> 
> 
> if ($FORM{$name} == 0) {
>                     # what goes here to get those variables equal to 0
> 
> out of the next step of my processing?
>             }
> 
> LK
> 
> 


for (keys %FORM) {
      undef $FORM{$_} if ($FORM{$_} == 0);
}

-anders
-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Fri, 13 Oct 2000 16:57:14 +0200
From: "Werner, Wolfgang" <zakazan@gmx.de>
Subject: Re: Perl conditional functions
Message-Id: <39E722C9.B771F8A@gmx.de>

hm, i'm sure your're all deeper into perl than i am, so correct me if i'm
talking nonsense...
why not:
    if ($FORM{$name} == 0) {delete $FORM{$name}}


Liam wrote:

> I have having a little trouble with a form I am writing.  I know that
> is also a CGI issue, but I think the problem I have is with Perl.
>
> In my conditional statement I want any of the variables with the value
> of '0' to be disregarded from the rest of the program.
> But I am not sure how to do this.  Is it possible to find out which
> have the value of zero and remove them?
>
> Any and all help offered is greatly appreciated.
>
> if ($FORM{$name} == 0) {
>                     # what goes here to get those variables equal to 0
>
>         out of the next step of my processing?
>             }
>
> LK



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

Date: Fri, 13 Oct 2000 14:58:35 GMT
From: lkenny@fisheries.org (Liam)
Subject: Re: Perl conditional functions
Message-Id: <39e7230d.11073678@news.volocom.net>

Oh, yeah, duh!

Thanks

On Fri, 13 Oct 2000 10:40:07 -0400, "Eric" <eric.kort@vai.org> wrote:

>"Liam" <lkenny@fisheries.org> wrote in message
>news:<39e71891.8389967@news.volocom.net>...
>
>> if ($FORM{$name} == 0) {
>
>> # what goes here to get those variables equal to 0
>
>>
>
>> out of the next step of my processing?
>
>> }
>
>How about:
>
>if ($FORM{$name} != 0) {
>
>
>   # whatever you want to do with the values _not_ equal to zero
>
>}
>
>hth
>
>Eric
>
>
>





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

Date: Fri, 13 Oct 2000 14:16:33 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Perl rules - Pyhton drools
Message-Id: <ant131333d07fNdQ@oakseed.demon.co.uk>

In article <8s6knk$mb4$1@ctb-nnrp2.saix.net>, Wayne Paterson
posted a 313K JPEG image which was 431K after UU encoding
and took a long time to download over my modem. This group
is not for binaries - post a URL instead. Also, learn how to
optimise graphics. Just by loading and resaving this JPEG it
dropped in size from 313K to 109K.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Fri, 13 Oct 2000 11:27:24 GMT
From: qureshii@my-deja.com
Subject: Please Please Help
Message-Id: <8s6rio$c6s$1@nnrp1.deja.com>

Hi I am a new perl student and what I need to do it to write a script
which takes in a C++ file and print out all the files listed only in
#include<iostream.h>
#include<hello.c>

i.e the out put should be
iostream.h
hello.c

so far when I am trying to extract it
what i get as a result of $1 is


hello.c




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


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

Date: Fri, 13 Oct 2000 12:17:53 GMT
From: PhyloBhetto <awright@jwac.osis.gov>
Subject: Re: pushing an array of records
Message-Id: <8s6uhd$eca$1@nnrp1.deja.com>

It was my print routine... I had forgotten a "$" on an array index!!
Thanks for the response.


In article <39CBCE1A.C2523BDC@ipac.caltech.edu>,
  tim@ipac.caltech.edu wrote:
> phylobhetto@my-deja.com wrote:
> >
> > I'm trying to create an array of records.  I get
> > the contents of a directory and store them in an
> > array.  From there, I split each array element
> > into the different elements of my record.  Now I
> > need to insert that entire record into a separate
> > array... that's where the trouble is.  My code is
> > similar to this:
> >
> > #read in data
> > @list = `/bin/ls -1`;
> >
> > #insert data into records
> > foreach $line (@list) {
> >   ($var1,$var2,$var3) = split (/_/,$line);
> >   $rec = {};
>
> ... creates a new hash reference.
>
> >   $rec -> {TEMP1} = $var1;
> >   $rec -> {TEMP2} = $var2;
> >   $rec -> {TEMP3} = $var3;
>
> ... populates the hash refered to by $rec ...
>
> >   push @arrayOfRecords, $rec;
>
> ... pushes each new reference onto the list.
>
> > }
> >
> > I don't know the purpose of the "$rec = {}" but
> > when it's there, and I print the array, I get the
> > first item in the @list array.
>
> All the elements of @arrayOfRecords are there, so either there's a
difference
> between your sample code and your real code, or it's how you're
trying to
> access/print its elements. Care to show us that?
>
> > When it's not there and I print, I get the last item in the
> > @list array.
>
> Because you're pushing the same array ref over and over again, and
the hash ref
> refered to only holds one record at a time.
>
> Read perlref through. Read first, post later.
>
> --
>
> -- Tim Conrow         tim@ipac.caltech.edu                           |
>


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


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

Date: Fri, 13 Oct 2000 15:51:05 +0200
From: Richard Wagner <RichardWagner@gmx.net>
Subject: system() & ENV{PATH} Problem
Message-Id: <39E71349.CA8B1270@gmx.net>

Hello,

when i set in my perl script the environment variable PATH, and call
then via system() a program, it seems to be that the execution path is
influenced by something else?

Code:
$ENV{PATH}=".;E:/jdk1.3/bin"
print $ENV{PATH},"\n";
system("java - version");

Output:
 .;E:/jdk1.3/bin
Symantec Java! JustInTime Compiler Version 3.10.107(x) for JDK 1.2
Copyright (C) 1996-99 Symantec Corporation
java version "1.2.2"
Classic VM (build JDK-1.2.2_006, native threads, symcjit)

I excpected as output:
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

I've both java versions on my maschine. The jdk 1.2 is set by default in
the system environment variable path.
But how can this happen when i explictly set the PATH before system() ?
Does system() use an other settings prior to PATH?

Thanks for you help
Richard



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

Date: Fri, 13 Oct 2000 16:31:52 +0200
From: Per Kistler <kistler@gmx.net>
To: Richard Wagner <RichardWagner@gmx.net>
Subject: Re: system() & ENV{PATH} Problem
Message-Id: <39E71CD8.D4C25781@gmx.net>

Richard Wagner wrote:

> Code:
> $ENV{PATH}=".;E:/jdk1.3/bin"
> print $ENV{PATH},"\n";
> system("java - version");

It would be good to test the same thing but with:

system "java","-version";

This avoids, that a shell will be called, which might read
your profiles first.

Per.


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

Date: Fri, 13 Oct 2000 11:08:45 GMT
From: qureshii@my-deja.com
Subject: Urgent Help wanted with text processing
Message-Id: <8s6qfr$bcb$1@nnrp1.deja.com>

Hi I am a new perl student and what I need to do it to write a script
which takes in a C++ file and print out all the files listed only in
#include<iostream.h>
#include<hello.c>

i.e the out put should be
iostream.h
hello.c

so far when I am trying to extract it
what i get as a result of $1 is hello.c


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


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

Date: 13 Oct 2000 11:47:44 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Urgent Help wanted with text processing
Message-Id: <slrn8udtk5.pin.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 13 Oct 2000 11:08:45 GMT, qureshii@my-deja.com
<qureshii@my-deja.com> wrote:
>Hi I am a new perl student and what I need to do it to write a script
>which takes in a C++ file and print out all the files listed only in
>#include<iostream.h>
>#include<hello.c>
>
>i.e the out put should be
>iostream.h
>hello.c
>
>so far when I am trying to extract it
>what i get as a result of $1 is hello.c

perl -lne 'print $1 if /^#include\s*<(.+?)>/' <input file(s)>

If you want to grab includes such as:

#include "bla.h"

use:

perl -lne 'print $1 if /^#include\s*(?:<|")(.+?)(?:>|")/' <input file(s)>

Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'


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

Date: Fri, 13 Oct 2000 12:41:59 GMT
From: qureshii@my-deja.com
Subject: Re: Urgent Help wanted with text processing
Message-Id: <8s6vun$fji$1@nnrp1.deja.com>

Thanks Bernard it was great my problem was inside the parenthesis (\w+)

Qii

In article <slrn8udtk5.pin.bernard.el-hagin@gdndev25.lido-tech>,
  bernard.el-hagin@lido-tech.net wrote:
> On Fri, 13 Oct 2000 11:08:45 GMT, qureshii@my-deja.com
> <qureshii@my-deja.com> wrote:
> >Hi I am a new perl student and what I need to do it to write a script
> >which takes in a C++ file and print out all the files listed only in
> >#include<iostream.h>
> >#include<hello.c>
> >
> >i.e the out put should be
> >iostream.h
> >hello.c
> >
> >so far when I am trying to extract it
> >what i get as a result of $1 is hello.c
>
> perl -lne 'print $1 if /^#include\s*<(.+?)>/' <input file(s)>
>
> If you want to grab includes such as:
>
> #include "bla.h"
>
> use:
>
> perl -lne 'print $1 if /^#include\s*(?:<|")(.+?)(?:>|")/' <input file
(s)>
>
> Cheers,
> Bernard
> --
> perl -le '$#="Just Another Perl Hacker"; print \Bernard'
>


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


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

Date: Fri, 13 Oct 2000 13:15:22 GMT
From: qureshii@my-deja.com
Subject: Re: Urgent Help wanted with text processing
Message-Id: <8s71t5$h52$1@nnrp1.deja.com>

How can I apply the condtion of extracting the  ones enclosed in quotes

e.g
#include <iostream.h>
#include "hello.h"

the print out shoudl be
iostream.h
hello.h


In article <slrn8udtk5.pin.bernard.el-hagin@gdndev25.lido-tech>,
  bernard.el-hagin@lido-tech.net wrote:
> On Fri, 13 Oct 2000 11:08:45 GMT, qureshii@my-deja.com
> <qureshii@my-deja.com> wrote:
> >Hi I am a new perl student and what I need to do it to write a script
> >which takes in a C++ file and print out all the files listed only in
> >#include<iostream.h>
> >#include<hello.c>
> >
> >i.e the out put should be
> >iostream.h
> >hello.c
> >
> >so far when I am trying to extract it
> >what i get as a result of $1 is hello.c
>
> perl -lne 'print $1 if /^#include\s*<(.+?)>/' <input file(s)>
>
> If you want to grab includes such as:
>
> #include "bla.h"
>
> use:
>
> perl -lne 'print $1 if /^#include\s*(?:<|")(.+?)(?:>|")/' <input file
(s)>
>
> Cheers,
> Bernard
> --
> perl -le '$#="Just Another Perl Hacker"; print \Bernard'
>


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


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

Date: 13 Oct 2000 13:34:36 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Urgent Help wanted with text processing
Message-Id: <slrn8ue3si.pin.bernard.el-hagin@gdndev25.lido-tech>

On Fri, 13 Oct 2000 13:15:22 GMT, qureshii@my-deja.com
<qureshii@my-deja.com> wrote:
>How can I apply the condtion of extracting the  ones enclosed in quotes
>
>e.g
>#include <iostream.h>
>#include "hello.h"
>
>the print out shoudl be
>iostream.h
>hello.h

I already posted a solution which does both at once. It's the second
example of the two I posted in reply to your original post.

Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'


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

Date: 13 Oct 2000 14:06:22 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Urgent Help wanted with text processing
Message-Id: <slrn8ue5mu.bqc.clay@panix3.panix.com>

On Fri, 13 Oct 2000 11:08:45 GMT, qureshii@my-deja.com <qureshii@my-deja.com> 
wrote:

>Hi I am a new perl student and what I need to do it to write a script
>which takes in a C++ file and print out all the files listed only in
>#include<iostream.h>
>#include<hello.c>
>
>i.e the out put should be
>iostream.h
>hello.c
>
>so far when I am trying to extract it
>what i get as a result of $1 is hello.c

You'll certainly endear yourself to the group by posting the same damn 
message several times with different subject lines...

-- 
Clay Irving <clay@panix.com>
Television is a device that permits people who haven't anything to do to
watch people who can't do anything. 
- Fred Allen 


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

Date: 13 Oct 2000 12:31:44 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: Weekday at a date
Message-Id: <8s6vbg$mrm$1@solti3.sdm.de>

In article <39E6C732.904A8E30@schaffhausen.de>, Malte Ubl <ubl@schaffhausen.de> wrote:

>> >>I basically need to implement this function:
>> >>sub weekday_of_date(someDate)
>> Fastest possibility probably would be to use Perl's builtin function
>> "localtime()" (see "perldoc -f localtime"), but the range is only
>> 1970 - 2038 (on most systems).
>> For the range 1955 - ... as in your case Date::Calc is indeed a feasible
>> solution, since it's written in C internally for maximum speed.

> Just to let you know, I timed both variants with Benchmark.pm and both were
> under the measurable amount of time.

Increase the number of iterations to get more meaningful results!

> Thanx for your help,

You're welcome. :-)

> malte

Cheers,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: Fri, 13 Oct 2000 12:10:45 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: which perl modules are installed by deafult if any?
Message-Id: <udBF5.386$Tq1.24932@news010.worldonline.dk>

Pete wrote:

> Hi,
> 
> I was wondering if someone could put me straight on the following query:
> Which modules are installed by default when perl is installed on Linux
> and Windows '98?
> 
> I have looked at the documentation with the activestate version
> and cannot figure this out.
> 
> I find that a lot of samples I come across contain phrases like:
> USE XXX::YYY OR USE XXX
> For example: USE DBI
> I am familiar with integrating Perl with the MySQL database using the DBI
> method, but am not sure whether any modules are installed by default
> and can just be implementedusing the 'USE XXX' syntax.
> 
> Anyone have any views on this?
> 
> Any help received would be greatly appreciated as this would greatly
> enhance my patchy knowledge of perl.

I don't know the activestate package, but *real* perl has a tool known as 
perldoc. In a term (DOS prompt for you) type "perldoc perltoc", then if 
your pager allows searching search for the string "standard modules" 
(insensitive). (If you install less, you search by typeing "/string"

-- 
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]


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

Date: Fri, 13 Oct 2000 13:55:20 GMT
From: martinsegersten@my-deja.com
Subject: Win32-API.zip
Message-Id: <8s7485$j62$1@nnrp1.deja.com>

Hi!

I would like to get the  module "Win32-API.zip" to access general
windows-api functions. I've tried to download it from the web-page :

http://www.activestate.com/PPMPackages/zips/5xx-builds-only/

but it fails... Could anyone please help me either by mail me the zip-
file or explain what I can do.

Thanks.

Martin

email:martinsegersten@hotmail.com

PS
I have tried the corresponding module at http://dada.perl.it/#api but
it does not work with my perl version.
DS


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


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4606
**************************************


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