[16743] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4155 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 28 18:12:44 2000

Date: Mon, 28 Aug 2000 15:10:32 -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: <967500631-v9-i4155@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 28 Aug 2000     Volume: 9 Number: 4155

Today's topics:
    Re: How to Unzip a .tar.gz file (BUCK NAKED1)
    Re: How to Unzip a .tar.gz file <sariq@texas.net>
    Re: How to Unzip a .tar.gz file <bart.lateur@skynet.be>
    Re: Mailform doesn't work for AOL? <djjoshuad.nospam@nospam.yahoo.nospam.com>
    Re: Managing Temporary Directories/Files (David H. Adler)
    Re: my($a)=shift or warn; (Abigail)
    Re: my($a)=shift or warn; <bart.lateur@skynet.be>
    Re: MySQL and perl (Abigail)
    Re: New user <ddorward@hotmail.com>
    Re: newline and carriage return problems flanagab@hqamc.scott.af.mil
    Re: Parsing a Excell table - or - a "Tab New_Line" text <etienno@my-deja.com>
    Re: pattern matching question <tina@streetmail.com>
    Re: pattern matching question <callgirl@la.znet.com>
    Re: pattern matching question (Jakob Schmidt)
    Re: pattern matching question <lr@hpl.hp.com>
    Re: pattern matching question (Abigail)
    Re: pattern matching question (Abigail)
    Re: pattern matching question <callgirl@la.znet.com>
    Re: Perl binary file download using octet-stream <lr@hpl.hp.com>
        Perldoc help needed (BUCK NAKED1)
    Re: Perldoc help needed <johan.brattemark@net2000.ch>
        Please help: How to check for $var is null or not? kiran_mamidi@my-deja.com
    Re: Please help: How to check for $var is null or not? houseofpain@my-deja.com
    Re: Please help: How to check for $var is null or not? (Jakob Schmidt)
    Re: Please help: How to check for $var is null or not? (Jakob Schmidt)
    Re: Please help: How to check for $var is null or not? <lr@hpl.hp.com>
    Re: Please help: How to check for $var is null or not? <ren.maddox@tivoli.com>
        processing files in a directory and stuff <gorbeast@SPAMSUCKS.subduction.org>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 28 Aug 2000 13:11:53 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: How to Unzip a .tar.gz file
Message-Id: <15313-39AAAB69-10@storefull-245.iap.bryant.webtv.net>

> gellyfish@gellyfish.com 
> (Jonathan=A0Stowe) wrote:
>> On Sun, 27 Aug 2000 22:20:46 GMT >> What A Man ! wrote: 
> <!doctype html public "-//w3c//dtd html 
> 4.0 transitional//en"> 
> *plonk* 
> /J\

Don't know what your problem is? I did not post in HTML. That doctype
line didn't show up on my newsreader, though I'm smart enough to realize
that all newsreaders are not created equal. Perhaps you need to realize
that too... that, not all newsreaders display the same as yours, and be
more flexible. Further... if it helps your ego to "plonk" rather than
"help"... have at it! 

-- 
Dennis



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

Date: Mon, 28 Aug 2000 13:53:52 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: How to Unzip a .tar.gz file
Message-Id: <39AAB540.328CFF30@texas.net>

BUCK NAKED1 wrote:
> 
> > gellyfish@gellyfish.com
> > (Jonathan Stowe) wrote:
> >> On Sun, 27 Aug 2000 22:20:46 GMT >> What A Man ! wrote:
> > <!doctype html public "-//w3c//dtd html
> > 4.0 transitional//en">
> > *plonk*
> > /J\
> 
> Don't know what your problem is? I did not post in HTML.

From the headers of your post:

Content-Type: text/html; charset=iso-8859-2

> That doctype
> line didn't show up on my newsreader, though I'm smart enough to realize
> that all newsreaders are not created equal.

Which is why you should learn how to use yours.

- Tom


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

Date: Mon, 28 Aug 2000 20:09:59 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How to Unzip a .tar.gz file
Message-Id: <5pglqss03lr0prm2nh7eateovfd1d8b1u2@4ax.com>

BUCK NAKED1 wrote:

>Can someone please help me out with a  perl script(not command line
>input) for unzipping a .tar.gz file from my Unix/Apache webserver.

The module Archive:::Tar may help. The disadvantage is that  the WHOLE
unzipped file is in memory at once.

	use Archive::Tar;
	my $tar = Archive::Tar->new("ultrakdata1.tgz",1);
	foreach my $file ($tar->list_files) {
	    if($file =~ /\/$/) {
	        print "Dir: $file\n";
	    } else {
	        my $contents = $tar->get_content($file);
	        my $length = length $contents;
	        print "File: $file  length: $length bytes\n";
	    }
	}


And tar itself can be used to decompress .tar.gz files in one go.

	tar -xzPf filename.tar.gz -C /where/do/you/want/it

Make sure the directory /where/do/you/want/it exists.

-- 
	Bart.


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

Date: Mon, 28 Aug 2000 13:47:33 -0500
From: "Joshua Dann" <djjoshuad.nospam@nospam.yahoo.nospam.com>
Subject: Re: Mailform doesn't work for AOL?
Message-Id: <ctyq5.20$su2.31876@nnrp2.sbc.net>

Do you mean that users who are dialed in to AOL cannot submit mail forms?
Or do you mean that the script will not submit to al AOL address?

JD

"Tsugihiko Tanaka" <tsugiimage@yahoo.com> wrote in message
news:8oe8uo$j01$1@news.ysu.edu...
>   I set up a mailform on a webpage, but it seems not working using AOL .
>
> Thank you,
>
> Tsugiimage
>
>
>




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

Date: 28 Aug 2000 22:04:44 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Managing Temporary Directories/Files
Message-Id: <slrn8qlofs.cv3.dha@panix2.panix.com>

On Mon, 28 Aug 2000 03:59:17 GMT, Brock <brock_johnson@my-deja.com>
wrote:

>I noticed that Brian d Toy

I must admit, that's a *new* violation of the style guide... :-)

http://www.brian-d-foy.com/style.html

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
make sure you're not trying to read a 2gb straight to memory (unless
you have a macintosh portable and you're trying to establish a tcp/ip
link to an alien space ship)	  - Brendon Caligari in alt.perl


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

Date: 28 Aug 2000 20:02:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: my($a)=shift or warn;
Message-Id: <slrn8qlh8b.bbg.abigail@alexandra.foad.org>

Bart Lateur (bart.lateur@skynet.be) wrote on MMDLIII September MCMXCIII
in <URL:news:ranhqsklpth2np5eckev2tdkaud5n08dp2@4ax.com>:
:: Hans Ginzel wrote:
:: 
:: >   What does the assignmen my($a)=shift return?
:: 
:: Whatever the shift returns.

Really? Did you _try_? I guess not.

    $ perl -wle 'sub test {my $b = my ($a) = shift; print $b} test "foo"'
    1
    $

:: If you passed no argument to your sub, that will be undef.

Wrong.

    $ perl -wle 'sub test {my $b = my ($a) = shift; print $b} test'
    1
    $

Assignment is context sensitive.

Abigail
-- 
$_ = "\x3C\x3C\x45\x4F\x54"; s/<<EOT/<<EOT/e; print;
Just another Perl Hacker
EOT


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

Date: Mon, 28 Aug 2000 21:14:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: my($a)=shift or warn;
Message-Id: <9gllqs8hagds7sprjgrgg2s6hh8nhic1ov@4ax.com>

Abigail wrote:

>:: >   What does the assignmen my($a)=shift return?
>:: 
>:: Whatever the shift returns.
>
>Really? Did you _try_? I guess not.

I cancelled that message minutes after I posted it. If all went well,
you shouldn't even have seen it. The parens in the declaration make
things different.
 
-- 
	Bart.


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

Date: 28 Aug 2000 20:03:07 GMT
From: abigail@foad.org (Abigail)
Subject: Re: MySQL and perl
Message-Id: <slrn8qlhac.bbg.abigail@alexandra.foad.org>

Abel Almazan (abel@inlander.es) wrote on MMDLIV September MCMXCIII in
<URL:news:39AA61A3.CC1E0EB0@inlander.es>:
// What i need to connect to a Mysql database with perl??

A running mysql server.


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: Mon, 28 Aug 2000 21:23:53 +0100
From: David Dorward <ddorward@hotmail.com>
To: NBNet News <answers@siriussolutions.com>
Subject: Re: New user
Message-Id: <39AACA59.D56D88B7@hotmail.com>

NBNet News wrote:
> 
> Hi folks
> 
> I am a new user, and am having a little problem.  I have a perl script which
> I want to run on an IIS server.  I believe I need some runtime files to
> execute this, but I'm not sure.  Does anybody have insight for me?
> 
> Nick Bishop
> nick@siriussolutions.com

ActivePerl will probably do you. It is free from:

http://www.activestate.com/Products/ActivePerl/Download.html

-- 
David Dorward
http://www.dorward.co.uk/


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

Date: Mon, 28 Aug 2000 21:25:20 GMT
From: flanagab@hqamc.scott.af.mil
Subject: Re: newline and carriage return problems
Message-Id: <8oelb8$69u$1@nnrp1.deja.com>

                           THANK YOU!!!
                           THANK YOU!!!
                           THANK YOU!!!

You were the one who answered my question.  I already had the regular
expression working.  All I needed was to use the "binmode FILE" command,
so my results wouldn't be altered before writing to the file.

It worked wonderfully.  Thanks very much!!!

In article <MPG.140c8c5ba4c482b39896d6@localhost>,
  jason <elephant@squirrelgroup.com> wrote:
>   [ posted to comp.lang.perl.misc and CCed to originator ]
>
> I've been reading through this thread I think you've sufferred enough
> *8^) .. it would seem that everyone has read the subject line of your
> post and nothing else (then you started posting upside down and that
got
> you in even more trouble)
>
> so .. here goes
>
> flanagab@hqamc.scott.af.mil <flanagab@hqamc.scott.af.mil> wrote ..
> >I'm trying to do some simple processing of a HTML document's forms.
> >All of the data has been passed to a Perl script by the standard POST
> >method.  I have no problems except with the TEXTAREAs.  These can
> >contain carriage returns (actually CR LF) within the box.
> >
> >I'm trying to write the output of the form to a data file in
> >tab-delimited form.  The trouble is that the LF is being interpreted
as
> >a newline.  I figured, no problem, I'll strip the \x0A from the
strings
> >before I write them to the file, however, when I tried to do this,
they
> >would NOT go away!
>
> probably because you're on a Win32 system (guess based on your article
> headers) and you haven't binmoded the output handle .. type the
> following at the command line to see documentation on binmode
>
>   perldoc -f binmode
>
> >I tried to split the string and chomp off the newline.  It came back.
 I
> >tried to split the string and chop off the newline, this chopped off
> >BOTH the \x0D and \x0A from the string.  The trouble here is, I want
to
> >KEEP the \cM.  I only want to be rid of the \cJ.
>
> here's some sample code
>
>   my $string = "blah\cM\cJblah\cM\cJblah\cM\cJ";
>
>   open OUTPUT, ">file" or die "Bad open: $!";
>   binmode OUTPUT;
>
>   print OUTPUT $string;
>
>   close OUTPUT or die "Bad close: $!";
>
> now .. file will contain the exact sequence of CRLFs in the above
string
> .. wanna strip off just the LFs
>
>   my $string = "blah\cM\cJblah\cM\cJblah\cM\cJ";
>
>   open OUTPUT, ">file" or die "Bad open: $!";
>   binmode OUTPUT;
>
>   $string =~ s/\cJ//g;
>
>   print OUTPUT $string;
>
>   close OUTPUT or die "Bad close: $!";
>
> now .. file will contain
>
>   "blah\cMblah\cMblah\cM"
>
> >I also tried going ahead and chopping off both characters, and then
> >reassembling the string, and appending the \x0D characters  to each
> >section of the string.  The string comes back with \x0d \x0a instead.
> >
> >When I attempt a logical expression to search and replace on the
string,
> >it will find the 0A, but it inserts it back in along with my
replacement
> >string.
> >
> >In summation, I can get rid of the \x0a characters, but not without
> >getting rid of the \x0d characters as well.  No matter what I try,
the
> >\x0a charaters won't go away.  Is there some switch or
> >configuration setting to correct this problem?  Does anyone have any
> >ideas?!
>
> I still don't know why you want to leave the CRs in there .. but I'm
> assuming that there's some logical reason
>
> HTH
>
> --
>   jason -- elephant@squirrelgroup.com --
>


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


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

Date: Mon, 28 Aug 2000 19:31:36 GMT
From: Etienne Laverdiere <etienno@my-deja.com>
Subject: Re: Parsing a Excell table - or - a "Tab New_Line" text file?
Message-Id: <8oeemo$u0b$1@nnrp1.deja.com>

Thanks all,

I have tried your solution, but I still have some problem with the
response. I have this error :

Software error:
Describe failed during DBI::st=HASH(0x8bbf0dc)->FETCH(NAME) at
D:\xitami\cgi-bin\ex1\excel.pl line 46.

here's the code I used:
use DBI;
use Data::Dumper;
my $drv  = 'ODBC:driver=Microsoft Excel Driver (*.xls)';
my $dir  = 'd:/data/base_prod.xls'; #an Excel file
my $table = 'table1'; #a range name
my $dbh  = DBI->connect( "dbi:$drv;Dbq=$dir",,,{RaiseError=>1} ) or die
$DBI::errstr;
my $sth  = $dbh->prepare("select * from $table");

error ----> $names=$sth->{NAME};
print $names;
for (@$names){print "field:$_\n"}
my $ref  = $sth->selectall_arrayref($sth);
print Dumper($ref);

So, I named my first row of my Excel table "NAME", but it d'dn't help.
It seems that sth contain nothing.


Thanks for your help.


Best Regards


Etienne Laverdiere




In article <39A9524F.D0ADF6C4@rochester.rr.com>,
  Bob Walton <bwalton@rochester.rr.com> wrote:
> Jeff Zucker wrote:
> >
> > Etienne Laverdiere wrote:
> > >
> > > I need to parse in a 2 dimentional array from an Excell document
through a
> > > Perl script that will isolate all the colonnes and the rows of
this Excell
> > > table.
> > > ...
> > > I would like, finaly to access my ODBC database with each value,
and build a
> > > database table (I have already done that with DBI).
> >
> > Excel *is* an ODBC accessible database.  You don't need to take the
> > information out of Excel into something else and then put it back
into
> > some other ODBC source, you just access the Excel spreadsheet just
like
> > any other DBI database:
> >
> > use DBI;
> > my $drv   = 'ODBC:driver=Microsoft Excel Driver (*.xls)';
> > my $dir   = $directory_where_spreadsheet_is_stored;
> > my $table = $name_of_spreadsheet; # e.g. 'test.xls'
> > my $dbh   = DBI->connect( "dbi:$drv;Dbq=$dir",,,{RaiseError=>1} )
> >             or die $DBI::errstr;
> > my $sth   = $dbh->prepare("SELECT * FROM $table");
> > # ... etc.
> >
> > If you really want to go the route of exporting the Excel
spreadsheet to
> > a tab delimited file and then putting that into an array, then use
> > DBD::RAM or DBD::CSV and the fetchall_arrayref method.
> >
> > --
> > Jeff
>
> Jeff, thanks very much for your input -- I didn't know you could do
that
> with Excel.  Where does one find docs on this? -- I looked through
> everything I've got on Excel, and it is not mentioned.  I think I'll
use
> this method most of the time from now on, rather than OLE.
>
> I found, though, that some of the stuff in your example code isn't
quite
> right -- the $dir needs to include the spreadsheet file, and the
$table
> is an Excel range name (insert..name..define), not the name of the
> spreadsheet.  Here is a complete working example, given a spreadsheet
> that has a range with the name "table1".  The SQL field names are
taken
> from the first row of the named range, unless that row is numeric, in
> which case it makes up field names.
>
> #example of using DBI with Excel
> use DBI;
> use Data::Dumper;
> my $drv   = 'ODBC:driver=Microsoft Excel Driver (*.xls)';
> my $dir   = 'c:/bob/junk/junk194.xls'; #an Excel file
> my $table = 'table1'; #a range name
> my $dbh   = DBI->connect( "dbi:$drv;Dbq=$dir",,,{RaiseError=>1} )
>             or die $DBI::errstr;
> my $sth   = $dbh->prepare("select * from $table");
> $names=$sth->{NAME};
> for (@$names){print "field:$_\n"}
> my $ref   = $dbh->selectall_arrayref($sth);
> print Dumper($ref);
>
> --
> Bob Walton
>


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


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

Date: 28 Aug 2000 18:43:33 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: pattern matching question
Message-Id: <8oebsh$aftne$1@ID-24002.news.cis.dfn.de>


well, don't feed the trolls. but I could not
resist, this is too ridiculous...

Godzilla! <callgirl@la.znet.com> wrote:
> "Andrew N. McGuire" wrote:
>  
>> Godzilla! wrote:

> Yeah, so what? This test script does
> precisely and exactly what the author
> asks per his parameters.

it's a question of how you understand the
parameters. In my opinion your
script does not meet the requirements.
why do you feel attacked everytime somebody
corrects what you're saying. everybody else says,
"oh yes, must've been tired" or even improves
the corrected solution. you just think everybody
wants to attack you and make you look bad.
nobody said your script is *bad*. oh well,
calm down.
you must be very frustrated.

>> print "Boss, string is too short.\n $string"; exit;
>> why not just:
>> die "The input string is too short!\n $string\n";

> What do you mean why not? This is my script. I put out
> effort to throw this together. I will write it any

> way I want, Adolf.

absolutely ridiculous.
well i could write more about this, many other have,
it's just no use. you can't beat trolls with reasonable
arguments, just like members of some religious
groups (I don't want to offend anybody)

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Mon, 28 Aug 2000 11:50:32 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: pattern matching question
Message-Id: <39AAB478.500B8E06@la.znet.com>

Tina Mueller wrote:
 
> well, don't feed the trolls. but I could not
> resist, this is too ridiculous...

> Godzilla! wrote:
> > "Andrew N. McGuire" wrote:
> >> Godzilla! wrote:


(snipped)


Quite ridiculous, Frank.

Godzilla!

-- 
Perl Monger's Perfect Perl Perl Land.
  http://la.znet.com/~callgirl/perlperl.cgi


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

Date: Mon, 28 Aug 2000 21:17:51 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: pattern matching question
Message-Id: <1eg3esk.zv36881a7xs6cN@[192.168.88.117]>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:

> Wyzelli wrote:
>  
> >  Nuff Sed.
> 
> No, not enough is said. You are childish, petty and
> grasping at any lame excuse to afford yourself a
> chance to be hateful.

Oh man - I'm sorry to go off-topic but this is the first time I ever
bothered to read any of Godzillas post in a thread all the way through -
and it's hillarious.

I've never read anything more funny on usenet. What A completely wild
and explosive reaction when someone reveals a pretty obvious error in
his script. It reminds me of the characters in the English TV-series
"Bottom" (two guys from the old "The Young Ones" crew). Does any of you
know it?

Unbelievable!

I expect it'll get pretty boring rather fast though...

-- 
Jakob


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

Date: Mon, 28 Aug 2000 12:23:05 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: pattern matching question
Message-Id: <MPG.14145bf0f80d09cb98ace7@nntp.hpl.hp.com>

In article <39A9B381.F49D65D6@stomp.stomp.tokyo> on Sun, 27 Aug 2000 
17:34:09 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...

 ...

> if (${\length ($string)} > 11)

Others have commented at length about the ludicrous nature of this non-
solution.  I am just bemused by the additional reference-dereference 
going on in the above expression.  Unless being paid by the keystroke, I 
cannot imagine why one would write that instead of simply:

  if (length($string) > 11)

(or even without the inner parentheses, if one were so inclined.)

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


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

Date: 28 Aug 2000 20:22:38 GMT
From: abigail@foad.org (Abigail)
Subject: Re: pattern matching question
Message-Id: <slrn8qlieu.bbg.abigail@alexandra.foad.org>

David Gay (david@palmetto.net) wrote on MMDLIII September MCMXCIII in
<URL:news:39a996b4.4028269@news.duesouth.net>:
$$ Greetings-
$$ 
$$ I'm trying to check a pattern to ensure that it's a 6 digit, hyphen
$$ delimited set of numbers, each no less than 0 nor greater than 4 .
$$ 
$$ Example:
$$ 0-1-2-3-4-4 or 1-2-1-3-4-0 is acceptable.
$$ 02-1-2-3-4-4 or 0-1-2-3-4-5 is not acceptable.
$$ 
$$ I must specify to only match a single occurence of each digit,
$$ therefore using ? for zero or one occurence is no good, nor is * for
$$ zero or more occurences.
$$ 
$$ So I tried {1} to specify exactly one occurence like this:
$$ 
$$ if ($spec_pat !~
$$ /[0-4]{1}\-[0-4]{1}\-[0-4]{1}\-[0-4]{1}\-[0-4]{1}\-[0-4]{1}/ {
$$ 	miscellaneous code;
$$ }
$$ 
$$ This will still match 02-0-1-2-3-4 which is not what I desire.
$$ 
$$ What've I overlooked here?


Anchors. You ask it to match any occurance of 6 hyphen delimited digits
in your string. And "02-1-2-3-4-4" contains such a substring.

You want to use ^ and \z to anchor your regexes.


Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: 28 Aug 2000 20:24:57 GMT
From: abigail@foad.org (Abigail)
Subject: Re: pattern matching question
Message-Id: <slrn8qlija.bbg.abigail@alexandra.foad.org>

Jakob Schmidt (sumus@aut.dk) wrote on MMDLIII September MCMXCIII in
<URL:news:1eg1uxh.1qy04civluwl5N@[192.168.88.117]>:
^^ Jakob Schmidt <sumus@aut.dk> wrote:
^^ 
^^ > /^[0-4]\-[0-4]\-[0-4]\-[0-4]\-[0-4]\-[0-4]$/
^^ > 
^^ > or /^([0-4]\-){5}[0-4]$/
^^ 
^^ make that
^^ 
^^ /^[0-4]-[0-4]-[0-4]-[0-4]-[0-4]-[0-4]$/
^^  
^^ or /^([0-4]-){5}[0-4]$/

Which would still match "0-1-2-3-4-0\n". Use /^([0-4]-){5}[0-4]\z/ if you
want to make sure there isn't a trailing newline.



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


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

Date: Mon, 28 Aug 2000 13:30:37 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: pattern matching question
Message-Id: <39AACBED.73633B34@la.znet.com>

Larry Rosler wrote:

> Godzilla! wrote:

> > if (${\length ($string)} > 11)
 
> Others have commented at length about the ludicrous 
> nature of this non- solution.

If mine is a non-solution,  why does my test code
do more and do it better than any other code offered?
Yours is a statement of such ignorance, it is stupefying.
What others, actually all one person, have commented
amounts to stupidity exceeding only your own, in your 
opening volley, which, amusingly, inflicted a rather
cute bullet wound in your left foot.


> I am just bemused by the additional reference-dereference
> going on in the above expression.  Unless being paid by the
> keystroke, I cannot imagine why one would write that instead
> of simply:
 
>   if (length($string) > 11)
 
> (or even without the inner parentheses, if one were so inclined.)

Well, at least you have sense enough to stay within
parameters and avoid idiotic "what if" behavior yet
not enough sense to not make a fool of yourself. This
is a fair assessment. Your code, my code, perform the
same task with different styles. I would not critique
your critique except to say my code is visually pretty
where yours is much like you; boringly mundane.

I will critique you for initiating your article response
with stupidity fitting only for an Idiot Savant. I know
you are capable of a greater display of intelligence.
A bit of shame you don't; I respect your Perl knowledge
but find both your ego and personality, contemptuous.

Godzilla!

-- 
Perl Monger's Perfect Perl Perl Land.
  http://la.znet.com/~callgirl/perlperl.cgi


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

Date: Mon, 28 Aug 2000 12:03:14 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Perl binary file download using octet-stream
Message-Id: <MPG.14145749662bb5d698ace6@nntp.hpl.hp.com>

In article <39A9BBC1.2DA0BF7@wsb.com> on Mon, 28 Aug 2000 01:07:23 GMT, 
Jeff Helman <jhelman@wsb.com> says...
> rusty_mason@my-deja.com wrote:
> > 
> > Hello, Perl wizards, how are you? I hope you can help me, I've got a
> > script here I can't get working. I'm trying to validate users before
> > letting them download certain binary files.  The script below is the
> > best thing I could piece together so far, but it doesn't work. Does
> > anyone know why? This is running on Unix/Apache.

 ...

> > #!/usr/bin/perl
> > 
> > $binary = "robert_e_mason.doc";
> > 
> > $size = -s "$binary";

No need for quotes around a simple scalar variable.

> > open(INFILE,"<$binary") or die $!;
> > 
> > print "Content-Type:application/octet-stream\n";
> > print "Content-Disposition:attachment; filename=robert_e_mason.doc\n";
> > print "Content-Length:$size\n\n";binmode(INFILE);binmode(STDOUT);
> > 
> > while(<INFILE>){
> 
> Here's your problem.  You've already declared that this is a binary
> file, yet you are attempting to read it as though it were an ASCII
> file.  The <> operator attempts to read a file one line at a time, but
> in a binary file there are no obvious linebreaks.

Agreed that it is poor style to read a file one 'line' at a time when 
there are no 'lines' in the file, this cannot be the source of the 
problem.  All the file will be read and copied, though how many bytes at 
a time would be impossible to say.

> A better option would be to use binmode() followed by the read() or
> sysread() functions (type "perldoc perlfunc" at the command prompt for
> further info).

True, but not the problem.

> >   print $_;
> > }
> > 
> > close(INFILE);

To the original poster:

As usual here, "it doesn't work" doesn't provide a great deal of 
information.  Could it be because the file dodn't open successfully?  
Could it be because your HTTP headers lack the required space after each 
colon?  What do the server logs say?

Whatever it is, it isn't likely to be a Perl problem, based on your 
code, so you might ask a CGI newsgroup.  But provide more details than 
this!

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


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

Date: Mon, 28 Aug 2000 13:37:54 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Perldoc help needed
Message-Id: <9979-39AAB182-2@storefull-242.iap.bryant.webtv.net>

What/where is perldoc -f? Is that the faqs about perl functions. I can't
download perl, so can I find "perldoc -f" in an .html or .txt file
somewhere on the net?

Muchas Gracias,
Dennis



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

Date: Mon, 28 Aug 2000 23:36:11 +0200
From: "Johan Brattemark" <johan.brattemark@net2000.ch>
Subject: Re: Perldoc help needed
Message-Id: <8oelf0$3d2$1@news.swissonline.ch>

Here you go:

http://www.perl.com/pub/doc/manual/html/pod/perlfunc.html

Johan

"BUCK NAKED1" <dennis100@webtv.net> wrote in message
news:9979-39AAB182-2@storefull-242.iap.bryant.webtv.net...
What/where is perldoc -f? Is that the faqs about perl functions. I can't
download perl, so can I find "perldoc -f" in an .html or .txt file
somewhere on the net?

Muchas Gracias,
Dennis





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

Date: Mon, 28 Aug 2000 19:17:26 GMT
From: kiran_mamidi@my-deja.com
Subject: Please help: How to check for $var is null or not?
Message-Id: <8oedrf$t48$1@nnrp1.deja.com>

Hi Guys
I need help with the following.

How do I check if a variable is null.


For example if I want to check $rec_date is null or not. How do I do
that,

Someone please help me


Thanks
Kiran


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


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

Date: Mon, 28 Aug 2000 19:37:34 GMT
From: houseofpain@my-deja.com
Subject: Re: Please help: How to check for $var is null or not?
Message-Id: <8oef1r$uk1$1@nnrp1.deja.com>

In article <8oedrf$t48$1@nnrp1.deja.com>,
  kiran_mamidi@my-deja.com wrote:
> Hi Guys
> I need help with the following.
>
> How do I check if a variable is null.
>
> For example if I want to check $rec_date is null or not. How do I do
> that,
>
> Someone please help me
>
> Thanks
> Kiran
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Try using if (defined $foo){}
-josh


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


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

Date: Mon, 28 Aug 2000 21:53:43 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: Please help: How to check for $var is null or not?
Message-Id: <1eg3gp8.1n4vzqtjbkmr3N@[192.168.88.117]>

<kiran_mamidi@my-deja.com> wrote:

> For example if I want to check $rec_date is null or not. How do I do
> that,

There's no null in Perl. If you wanna know if it's zero just

if ( $rec_date == 0 ) { print "It's zero\n" }

if you want to check if it's defined use the defined() bulitin (tricky,
yes?)

-- 
Jakob


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

Date: Mon, 28 Aug 2000 21:55:18 +0200
From: sumus@aut.dk (Jakob Schmidt)
Subject: Re: Please help: How to check for $var is null or not?
Message-Id: <1eg3guo.9ts25w1kynw71N@[192.168.88.117]>

Jakob Schmidt <sumus@aut.dk> wrote:

> use the defined() bulitin
                    ^^^^^^^

make that builtin

I'm afraid this is becoming my trade mark

-- 
Jakob


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

Date: Mon, 28 Aug 2000 13:02:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Please help: How to check for $var is null or not?
Message-Id: <MPG.141465397a8aca198acea@nntp.hpl.hp.com>

In article <8oedrf$t48$1@nnrp1.deja.com> on Mon, 28 Aug 2000 19:17:26 
GMT, kiran_mamidi@my-deja.com <kiran_mamidi@my-deja.com> says...

 ...

> How do I check if a variable is null.
> 
> 
> For example if I want to check $rec_date is null or not. How do I do
> that,

Does 'null' mean 'doesn't contain a defined value'?

    perldoc -f defined

Does 'null' mean 'contains the null string' ("")?

    perldoc -f length

There are many other ways to answer the latter question, but that is 
probably the easiest.

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


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

Date: 28 Aug 2000 14:54:04 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Please help: How to check for $var is null or not?
Message-Id: <m31yz95fhf.fsf@dhcp11-177.support.tivoli.com>

kiran_mamidi@my-deja.com writes:

> How do I check if a variable is null.
> 
> 
> For example if I want to check $rec_date is null or not. How do I do
> that,

unless (defined $rec_date) {
   # code goes here
}

For more information, have a look at:
perldoc -f defined

-- 
Ren Maddox
ren@tivoli.com


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

Date: Mon, 28 Aug 2000 14:55:55 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: processing files in a directory and stuff
Message-Id: <39AADFEB.D68C0CAA@SPAMSUCKS.subduction.org>

Hello,

I have a directory on a Win32 computer that has a large number of text
files, all of which have content similar to this :

	489384    44  34   foo  bar  9458  5i4i 345485
	483455    12  49   foo  bar  9589  7t9k 458945
	548899    87  09   foo  bar  5988  9489 650966

 ... and so on.  In other words, each line of each text file has the
format of: zero or more whitespaces, a string of numbers, more
whitespace, another string of numbers, yet more whitespace, another
number, whitespace, etc.

I am trying to figure out how the program can read each file of this
directory and keep a tally of how many times a number of the _first_
column occurs.  It will only occur once each file, but it could be
multiple files of this directory.

If any one can help me out that would be very kind and I thank you.

-G


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

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


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