[12370] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5970 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 12 04:07:32 1999

Date: Sat, 12 Jun 99 01:01:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 12 Jun 1999     Volume: 8 Number: 5970

Today's topics:
        importing comma-delimited data into perl? <kate.roberts@lib.monash.edu.au>
    Re: importing comma-delimited data into perl? <marchall@tampabay.rr.com>
    Re: indexing into a hash flounder99@my-deja.com
    Re: indexing into a hash (Larry Rosler)
    Re: indexing into a hash <uri@sysarch.com>
    Re: interesting problem involving query (Abigail)
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists (Thomas Weholt)
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists (Larry Rosler)
    Re: Is Javascript better than Perl? <bravo@bravodesign.com>
    Re: Large String handling (Tad McClellan)
    Re: Linus Torvalds and Carmen Electra? (Abigail)
    Re: MIcrosofts Attack on Perl (Greg Andrews)
    Re: multiple match & replace regexp (Abigail)
    Re: Perl Script - HELP! (Larry Rosler)
    Re: problem with no text outputting from Perl CGI scrip <marchall@tampabay.rr.com>
        problem with no text outputting from Perl CGI script (l <brutal@greenbaynet.com>
    Re: Silly Question: Define "Wrapper" (Abigail)
    Re: Verifying date data (Abigail)
    Re: Verifying date data (Abigail)
    Re: Verifying date data <sb@sdm.de>
        What module need to talk to serial port <tdnguyen@metricom.com>
    Re: What module need to talk to serial port <marchall@tampabay.rr.com>
    Re: What's the "halting problem"? (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sat, 12 Jun 1999 15:42:15 +1000
From: Kate Roberts <kate.roberts@lib.monash.edu.au>
Subject: importing comma-delimited data into perl?
Message-Id: <3761F337.C0B23167@lib.monash.edu.au>

Dear all: I'm very new at this, so please excuse asking what might be
obvious to others.

I have a file containing comma-delimited data (exported from EXCEL),
egmyfile...	"field1-wanted later","field2","field3-wanted"
	        "field1-wanted later","field2","field3-wanted"
	        "field1-wanted later","field2","field3-wanted"
 which I want to bring into perl, filter out most of the fields, and
then output the fields of interest.

I had thought that since you can assign separate fields to a list-array
as follows:
@listarray = ("field1-wanted later","field2","field3-wanted");

that it might also be possible to first put each line from the file into
a scalar, and then replicate the pattern above using that scalar
eg
open (FILEHANDLE, "myfile");
while ($scalar1 = <FILEHANDLE>) {
chomp $scalar1;
@listarray1 = ($scalar1);     #This line should be equivalent to above 
print "$listarray1[0]\n";
print "$listarray1[2]\n";
}
close(FILEHANDLE);

It doesn't work, though.
Can anyone advise me on how to achieve importing this data?

Many thanks,
Kate


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

Date: Sat, 12 Jun 1999 06:02:54 GMT
From: Nicholas Marchalleck <marchall@tampabay.rr.com>
Subject: Re: importing comma-delimited data into perl?
Message-Id: <3761F9FA.9696A127@tampabay.rr.com>

Kate Roberts wrote:

> Dear all: I'm very new at this, so please excuse asking what might be
> obvious to others.
>
> I have a file containing comma-delimited data (exported from EXCEL),
> egmyfile...     "field1-wanted later","field2","field3-wanted"
>                 "field1-wanted later","field2","field3-wanted"
>                 "field1-wanted later","field2","field3-wanted"
>  which I want to bring into perl, filter out most of the fields, and
> then output the fields of interest.
>
> I had thought that since you can assign separate fields to a list-array
> as follows:
> @listarray = ("field1-wanted later","field2","field3-wanted");
>
> that it might also be possible to first put each line from the file into
> a scalar, and then replicate the pattern above using that scalar
> eg
> open (FILEHANDLE, "myfile");
> while ($scalar1 = <FILEHANDLE>) {
> chomp $scalar1;
> @listarray1 = ($scalar1);     #This line should be equivalent to above
> print "$listarray1[0]\n";
> print "$listarray1[2]\n";
> }
> close(FILEHANDLE);
>
> It doesn't work, though.
> Can anyone advise me on how to achieve importing this data?
>
> Many thanks,
> Kate

I think what you're trying to do is a "split" on scalar1. Look up the perl
function split.

Realize, though,  this problem is a little more difficult than you think.
The reason is that fields can have ',' in them and in a CSV there has to be
some way to escape those embedded commas.

You don't have to worry about that though. You can simply use the module
Text::ParseWords.  The function you need here is quotewords. In case you
don't know, it's a standard Perl module so you can do "perldoc
Text::ParseWords" at the command and have all the info you need at your
disposal.



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

Date: Sat, 12 Jun 1999 02:10:11 GMT
From: flounder99@my-deja.com
Subject: Re: indexing into a hash
Message-Id: <7jsfhv$vmj$1@nnrp1.deja.com>

In article <375EDA53.2FD8C1C7@sismicro.com>,
  Jim Keefer <jim@sismicro.com> wrote:
> Since perl implements a hash as two parallel arrays, is there a way I
> can index into a hash?
>
> I need the speed of a hash key look up, but I also need to be able to
> get the hash key from an integer index.  Currently, I have a hash with
a
> string key and integer (index) value, and an array based on these
> indexes which also stores the string.  This gives me the fuctionality
I
> want.  But I have some pretty large arrays of strings, which I am
> storing twice because of this arrangement.  It would save time and a
lot
> of space if I could store it once in a hash, but still be able to
access
> the hash either by string key to get the index, or get the hash key by
> using an integer index.
>
> Email me with any suggestions.
> Thanks!
>

You can use the fact that an array can be turned
into a hash

#create an array of key, value pairs
@hasharray = qw (key0 value0 key1 value1 key2 value2);

# to add to the hasharray like this
push @hasharray, ("key3", "value3");

# to look up by index
$lookupindex = 1;
$value = $hasharray[2*$lookupindex+1];
print "$value\n";

# to look up by key
$lookupkey = "key1";
$value = (eval {return {@hasharray}})->{$lookupkey};
print "$value\n";

Of course this is extremely inefficient creating and
disposing of an annonymous hash on every lookup



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 11 Jun 1999 21:22:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: indexing into a hash
Message-Id: <MPG.11cb8061d11e8e52989bcb@nntp.hpl.hp.com>

In article <7jsfhv$vmj$1@nnrp1.deja.com> on Sat, 12 Jun 1999 02:10:11 
GMT, flounder99@my-deja.com <flounder99@my-deja.com> says...
 ... 
> #create an array of key, value pairs
> @hasharray = qw (key0 value0 key1 value1 key2 value2);
 ...
> # to look up by key
> $lookupkey = "key1";
> $value = (eval {return {@hasharray}})->{$lookupkey};
> print "$value\n";
> 
> Of course this is extremely inefficient creating and
> disposing of an annonymous hash on every lookup

It is even more inefficient if you use an unnecessary eval.  Why not use 
just this:

$value = {@hasharray}->{$lookupkey};

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


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

Date: 12 Jun 1999 00:51:32 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: indexing into a hash
Message-Id: <x7909qhvhn.fsf@home.sysarch.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> In article <7jsfhv$vmj$1@nnrp1.deja.com> on Sat, 12 Jun 1999 02:10:11 
  LR> GMT, flounder99@my-deja.com <flounder99@my-deja.com> says...
  LR> ... 
  >> #create an array of key, value pairs
  >> @hasharray = qw (key0 value0 key1 value1 key2 value2);
  LR> ...
  >> # to look up by key
  >> $lookupkey = "key1";
  >> $value = (eval {return {@hasharray}})->{$lookupkey};
  >> print "$value\n";
  >> 
  >> Of course this is extremely inefficient creating and
  >> disposing of an annonymous hash on every lookup

  LR> It is even more inefficient if you use an unnecessary eval.  Why not use 
  LR> just this:

  LR> $value = {@hasharray}->{$lookupkey};

and how do you delete entries by key?

As a better solution, perl 5.005 has experimental support for
pseudo-hashes which would allow for this. it uses an array whose first
entry is a hash of keys to array indexes (1 based, of course). see the
perl docs for more. Fields.pm uses this and makes the key to index
conversions happen at compile time.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 11 Jun 1999 19:23:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: interesting problem involving query
Message-Id: <slrn7m3ajn.37n.abigail@alexandra.delanet.com>

marktoth (marktoth@mindspring.com) wrote on MMCX September MCMXCIII in
<URL:news:7jrf0b$3pv$1@nntp4.atl.mindspring.net>:
"" Hello newsgroup,
"" 
"" I'm not a perl programmer (I have written some scripts about a year ago)

Then maybe you should hire one. Would you operate on your wife, and
then when you run into problems, post a question in a medical group
starting with "I'm not a surgeon, but..." ?

If you're not a Perl programmer, don't program in Perl.


"" Here's what I have:
"" 
"" my $querytype = $formdata{'querytype'};
"" 
"" I get information passed from the form into the $querytype "variable"
"" 
"" is there anyway to parse that string???

Yes, and any Perl programmer knows how. Because they have read the'
appropriate documentation.

"" In other words I want to check to see if the last character is an invalid
"" character (the / character)
"" if it is there I want to cut it off of the end

That's very easy, as any Perl programmer can tell you.

"" lets say $querytype = "WHERE+SP<>'"+"'/  (from the form)
"" 
"" and I want to remove the / from the end of $querytype
"" 
"" is this possible?????

Yes. As I said before.

"" The whole problem comes from MFC code.

That's irrelevant.

"" When I send the query through ie4.01 I get this:

Why should be care?

"" I can't figure out where the extra / is coming from so I thought well if its
"" there when it gets to the perl script then lets just take it off.  I know
"" programatically how I would do this in C++ code but not in perl and it would
"" save alot of time (the guy I contract for wrote the perl script  -> and hes
"" a stock broker not a programmer ->

Your point being?

"" All your help is extremely appreciated.  If you need the entire perl script
"" I would be happy to send it to you for review.

We don't need the script. What you need is to read the documentation.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 11 Jun 1999 09:23:24 GMT
From: u970130@studbo.hit.no (Thomas Weholt)
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <3760d464.31348599@news1.c2i.net>

Hi again,

Now, the problem now is that the script don`t know how many arrays to
handle beforehand. It gets keywords from the command-line, looks these
up in a database, and the result is some lists containing locations,
places in the database were the keywords can be found.

The problem is the line :
my @lol = \(@array1, @array2 ...);

How can I check to see if the array is defined and go into the line
above? What if I got three lists one time and fifteen the next? 

On Wed, 09 Jun 1999 20:26:23 GMT, u970130@studbo.hit.no (Thomas
Weholt) wrote:

>Hi,
>
>Perhaps I didn`t make it clear that I need to compute the intersection
>of more than 4-5 lists, often 10-12. And this varies. 
>
>It is part of a "complex" search-engine. 
>
>Thanks for trying though.



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

Date: Fri, 11 Jun 1999 21:10:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <MPG.11cb7d7e3ed2b485989bca@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <3760d464.31348599@news1.c2i.net> on Fri, 11 Jun 1999 
09:23:24 GMT, Thomas Weholt <u970130@studbo.hit.no> says...
> Now, the problem now is that the script don`t know how many arrays to
> handle beforehand. It gets keywords from the command-line, looks these
> up in a database, and the result is some lists containing locations,
> places in the database were the keywords can be found.
> 
> The problem is the line :
> my @lol = \(@array1, @array2 ...);
> 
> How can I check to see if the array is defined and go into the line
> above? What if I got three lists one time and fifteen the next? 

Start with an empty @lol, then push the individual array refs onto it as 
you come across them.

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


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

Date: Sat, 12 Jun 1999 00:09:22 -0500
From: Darrick Wolfe <bravo@bravodesign.com>
Subject: Re: Is Javascript better than Perl?
Message-Id: <3761EB82.F0B9C16C@bravodesign.com>

Wellllll, for one... Java and JavaScript are 2 totally different things. Macrosheep
wrote:

> I'm doing a project for an Independent Study at WPI.  I was wondering if anyone
> had feedback concerning Java's pluses and minuses vs. Perl as a script
> language?
>
> For example, do you think Java's more client-based processing is preferable to
> Perl's server-based?
>
> Are script languages something that helps usability of the web, or are they
> simply technological marvels that we do because we can, without realizing that
> the average American has a slow internet connection and many have slow
> computers (where Java can be quite annoying).
>
> Any feedback, positive or negative would be appreciated.  Thanks.
>
> --Macrosheep



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

Date: Fri, 11 Jun 1999 16:17:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Large String handling
Message-Id: <fsqrj7.9g8.ln@magna.metronet.com>

F. Brekeveld (brekevel@worldonline.nl) wrote:
: Hi,

: I have a very large string with repeated parts, actually it is a HTML
: page, and I want to split it into lines
: how to do that ?

: The page looks like:

: <TR><TD    .........></TD></TR><TR><TD>......</TD></TR>

: I want everything between the <TR><TD> and </TD></TR> on a separate line
: for further processing


while ( m#(<TR><TD.*?</TD></TR>)#g ) {
   print "$1\n";
}


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 11 Jun 1999 19:25:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Linus Torvalds and Carmen Electra?
Message-Id: <slrn7m3aod.37n.abigail@alexandra.delanet.com>

John Bjorgen (john.bjorgen@cplc.com) wrote on MMCX September MCMXCIII in
<URL:news:7jqtln$3e6$1@gaddy.interpath.net>:
&& They have absolutely nothing in common.
&& Now that I have everyone's attention - heres's my question -
&& 
&& Does anyone have experience using DBI and DBD::ODBC together to

Too bad. I dropped my DBI and DBD books the moment I saw the name Linus
Torvalds, and I'm not goint to pick them up again till Monday.




Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 11 Jun 1999 21:55:00 -0700
From: gerg@shell.ncal.verio.com (Greg Andrews)
Subject: Re: MIcrosofts Attack on Perl
Message-Id: <7jsp74$3ol$1@shell1.ncal.verio.com>

jrknoll <jknoll@ipt-inc.com> writes:
>
>I understand the need for protection of open source.  But do you really
>think MS can hurt perl?
>

"Could" hurt perl?  Yes.  'Embrace, Extend, Engulf.'


That doesn't mean I think it *will* happen, or even that it
*might* happen.  Just that it *could* happen.

  -Greg


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

Date: 11 Jun 1999 19:28:24 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: multiple match & replace regexp
Message-Id: <slrn7m3ats.37n.abigail@alexandra.delanet.com>

regurg (anonymous@web.remarq.com) wrote on MMCX September MCMXCIII in
<URL:news:929116131.27132@www.remarq.com>:
{} 
{} What I don't know, however is this: what if I want to
{} replace $1 ... $3 with something else? Analagous to this
{} (which doesn't work):
{}      if (/...( )...( )...( )/) {
{}         $1 = "foo";
{}         $2 = "bar";
{}         $3 = "smar";
{}      }

if (s/(...)( )(...)( )(...)( )/$1foo$3bar$5smar/) { ... }



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 11 Jun 1999 21:46:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl Script - HELP!
Message-Id: <MPG.11cb85edaa314d35989bcc@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <37618d0e.0@news1.svn.net> on Fri, 11 Jun 1999 22:27:27 GMT, 
Bill Pitz <bill@svn.net> says...
 ...
> Thu 06/03/99 07:44:29    212.16.133.43:1663     -1 IDENTIFIED 'Verygoodgirl' 0
> 
> So in this case, I want only the last line... and then I want to chop it down
> to just "'Verygoodgirl'" (The 's are important in the output because they
> distinguish between a registered user and an unregistered user.)
 ...

Merging your attempt at garnering the names from the logfile with TomP's 
code for processing them:

    {
	my %count;
	while (<>) {
	    $count{$1}++ if /IDENTIFIED '([^']+)'/;
	}
	for (sort keys %count) {
	    print "$_ was here $count{$_} times.<br>\n";
	}
    }

I'm not sure what role the single-quotes play in your output, but you 
can play with the regex to meet your needs.

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


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

Date: Sat, 12 Jun 1999 05:05:58 GMT
From: Nicholas Marchalleck <marchall@tampabay.rr.com>
Subject: Re: problem with no text outputting from Perl CGI script (long,  enclosure)
Message-Id: <3761EC92.4E0D3052@tampabay.rr.com>

See comments below...

Ben Mullen wrote:

> I'm having troubles with a CGI script that feeds in a html document template
> and adds in information that it gets from the cgi querry.  Basically my
> problem is that I get no output from the script.  I'm not sure where I'm
> going wrong since I'm taking a crash corse on Perl and my job needs this
> done in a week.  Below is the script as I have it so far:
>
> # !/usr/bin/perl -w
>
> # --init
> use CGI qw(:standard escapeHTML);
> use Text::ParseWords;
> #define variables
> $cgistring = "default" ; #cgi string
> $index = "0000"; #indexed car number
> $cartype = "C"; #car type
> $workdir = "~/"; #working directory
> $htmlfile = "car.html"; #file template to be loaded
> $html = ""; #the html file itself
> $info=""; #file info handle
> $description = ""; #car description
> $mileage = ""; #mileage
> $price =""; #price
> $damage=""; #damage
>
> #parse cgi string
> $cgistring = $ENV{'QUERY_STRING'};
> $index = substr($cgistring,0,4);
> $cartype = substr($cgistring,3,1);
>
> #parse short description file
> $defile = $index . $cartype . "SH.TXT";
> open (filehandle, $defile);
> @descstuff = <filehandle>;
> $description = $descstuff[0];
> $mileage = $descstuff[1];
> $price = $descstuff[2];
> $damage = $descstuff[3];
>
> #parse html file
> open (TEMPLATE, cars.html);
> while (<TEMPLATE>)
> {
>  $buffer .= $_;
> }
> $buffer =~ s/<!--cgi:description-->/$description/g;
> $buffer =~ s/<!--cgi:mileage-->/$mileage/g;
> $buffer =~ s/<!--cgi:price-->/$price/g;
> $buffer =~ s/<!--cgi:damage-->/$damage/g;
> $buffer =~ s/<!--cgi:index-->/$index/g;
> print $buffer;

No output at all? No errors? Not even the html from the template file? Did you
try running from the command line? You won't have the form input, but you can
still get an idea of what's wrong...hopefully.

The file name in the last open should be quoted, and you really should do:
open(<TEMPLATE>, "cars.html") or die "can't open cars.html: $!\n";

You would also need to print a header. So before you print $buffer, do
print header;
This prints "Content-Type:  text/html\n\n". Without this your html won't be
displayed in the browser, or cause browser to display error.

It's not easy to debug a Perl-CGI script. What I usually do is use print
statements at strategic points in the script to locate the problem area(s).
Also try perl -c scriptname from command line to do syntax check.

Hope this helps.



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

Date: Fri, 11 Jun 1999 22:07:28 -0500
From: "Ben Mullen" <brutal@greenbaynet.com>
Subject: problem with no text outputting from Perl CGI script (long, enclosure)
Message-Id: <7jskf3$13hk$1@news.inc.net>

I'm having troubles with a CGI script that feeds in a html document template
and adds in information that it gets from the cgi querry.  Basically my
problem is that I get no output from the script.  I'm not sure where I'm
going wrong since I'm taking a crash corse on Perl and my job needs this
done in a week.  Below is the script as I have it so far:

# !/usr/bin/perl -w

# --init
use CGI qw(:standard escapeHTML);
use Text::ParseWords;
#define variables
$cgistring = "default" ; #cgi string
$index = "0000"; #indexed car number
$cartype = "C"; #car type
$workdir = "~/"; #working directory
$htmlfile = "car.html"; #file template to be loaded
$html = ""; #the html file itself
$info=""; #file info handle
$description = ""; #car description
$mileage = ""; #mileage
$price =""; #price
$damage=""; #damage

#parse cgi string
$cgistring = $ENV{'QUERY_STRING'};
$index = substr($cgistring,0,4);
$cartype = substr($cgistring,3,1);

#parse short description file
$defile = $index . $cartype . "SH.TXT";
open (filehandle, $defile);
@descstuff = <filehandle>;
$description = $descstuff[0];
$mileage = $descstuff[1];
$price = $descstuff[2];
$damage = $descstuff[3];

#parse html file
open (TEMPLATE, cars.html);
while (<TEMPLATE>)
{
 $buffer .= $_;
}
$buffer =~ s/<!--cgi:description-->/$description/g;
$buffer =~ s/<!--cgi:mileage-->/$mileage/g;
$buffer =~ s/<!--cgi:price-->/$price/g;
$buffer =~ s/<!--cgi:damage-->/$damage/g;
$buffer =~ s/<!--cgi:index-->/$index/g;
print $buffer;





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

Date: 11 Jun 1999 19:35:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Silly Question: Define "Wrapper"
Message-Id: <slrn7m3bbk.37n.abigail@alexandra.delanet.com>

Sped Erstad (serstad@my-deja.com) wrote on MMCX September MCMXCIII in
<URL:news:7jre7v$kd3$1@nnrp1.deja.com>:
// 
// This may or may not show my ignorance, but can someone give me a good
// definition of the term "wrapper" -- I'm pretty sure that I'm using it
// correctly, but would like some confirmation:
// 
// I'm pretty much gathering that it's just a function (or routine,
// whatever) whose main purpose is to call another fucntion -- usually with
// some more restrictions so as to "protect" that function a little bit.
// Kind of like a function with a little "value-addedness" to it.


You are right on track.

Of course, it could also mean the piece of paper around your candy. ;)


Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 11 Jun 1999 19:36:26 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Verifying date data
Message-Id: <slrn7m3bct.37n.abigail@alexandra.delanet.com>

Skip Hollowell (thollowe@opentext.com) wrote on MMCX September MCMXCIII
in <URL:news:7jqvsd$27p2@enews4.newsguy.com>:
'' I have some data in a text file and I need to verify if the dates are valid
'' They are in the YYYYMMDD format.  I haven't found any data funtions
'' that will let me do this.


Check the Date:: and Time:: modules in CPAN.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 11 Jun 1999 19:37:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Verifying date data
Message-Id: <slrn7m3bf2.37n.abigail@alexandra.delanet.com>

Skip Hollowell (thollowe@opentext.com) wrote on MMCX September MCMXCIII
in <URL:news:7jr835$2buj@enews4.newsguy.com>:
== This isn't an option as the customer hasn't the libraries, and will not
== install them.


So you distribute them as part of your product.


What would you do if the customer said they haven't computers and
are unwilling to buy them?



Abigail
-- 
perl -wlpe '}$_=$.;{' file  # Count the number of lines.


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 12 Jun 1999 07:55:34 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: Verifying date data
Message-Id: <7jt3pm$43v$1@solti3.sdm.de>

In article <7jrs5f$pdt$1@nnrp1.deja.com>, gsherman2773@my-deja.com wrote:

> Hold on here a second.  I'm not sure that telling
> somebody about Date::Manip, Date::Calc, etc. is
> adequately dealing with the problem of verifying
> that a date string is indeed a valid date.  Great
> as those modules are, I haven't yet seen a
> function akin to the ' isdate($datestr) returns
> bool ' function.

Then you must be blind (from the Date::Calc man page):

       o if (check_date($year,$month,$day))
           
         This function returns "true" ("1") if the given three
         numerical values "$year", "$month" and "$day" constitute
         a valid date, and "false" ("0") otherwise.

There are also routines to decode a date string into the three
numerical constituents.

So you can write:

  if (check_date(Decode_Date_US($datestr)) { # valid date

Actually the Decode_Date-function already does it for you, so that
you can simply write:

  if (($year,$month,$day) = Decode_Date_US($datestr)) { # valid date

Hope this helps,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: Fri, 11 Jun 1999 21:55:58 -0700
From: "TDN" <tdnguyen@metricom.com>
Subject: What module need to talk to serial port
Message-Id: <7jsokk$1k9$1@wave.hypersurf.com>

I just download the perl5.17 from activestate.  What module would I need to
start writing script to talk to the serial port.

TDN




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

Date: Sat, 12 Jun 1999 05:14:53 GMT
From: Nicholas Marchalleck <marchall@tampabay.rr.com>
Subject: Re: What module need to talk to serial port
Message-Id: <3761EEAA.742DB71C@tampabay.rr.com>

TDN wrote:

> I just download the perl5.17 from activestate.  What module would I need to
> start writing script to talk to the serial port.
>
> TDN

Win32::SerialPort.

Just FYI, whenever you need to look up a module try www.perl.com, then check
out a CPAN site. You'll find modules listed by category, author, etc.

N.



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

Date: 11 Jun 1999 19:38:48 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: What's the "halting problem"?
Message-Id: <slrn7m3bgt.37n.abigail@alexandra.delanet.com>

Daniel Grisinger (dgris@moiraine.dimensional.com) wrote on MMCX September
MCMXCIII in <URL:news:m3zp26vn2i.fsf@moiraine.dimensional.com>:
~~ John Porter <jdporter@min.net> writes:
~~ 
~~ > In article <7joshb$nen$1@pegasus.csx.cam.ac.uk>,
~~ >   mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
~~ > >          my_complcated_function() ? "19$year" : 1900+$year;
~~ > >
~~ > > Determining whether that has a Y2K bug is clearly equivalent to the
~~ > > halting problem.
~~ > 
~~ > Yes; and
~~ > 
~~ >          my_truly_random_function() ? "19$year" : 1900+$year;
~~ > 
~~ > is equivalent to Schroedinger's famous thought-experiment.
~~ 
~~ Yes, but it is now some poor hacker someplace who is
~~ both dead and not-dead.  I wonder what that feels like?


Dark, as noone is opening the box.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5970
**************************************

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