[10515] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4107 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 29 19:06:36 1998

Date: Thu, 29 Oct 98 16:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 Oct 1998     Volume: 8 Number: 4107

Today's topics:
        @a = <FILE> doesn't read in entire file <cstolpe@acm.org>
    Re: @a = <FILE> doesn't read in entire file (Andrew M. Langmead)
    Re: @a = <FILE> doesn't read in entire file <r28629@email.sps.mot.com>
    Re: @a = <FILE> doesn't read in entire file (Martien Verbruggen)
    Re: ANN: "pgrep" = perl grep <peterm@zeta.org.au>
    Re: ANNOUNCE:  New Arrival (Stefaan A Eeckels)
    Re: ANNOUNCE:  New Arrival <r28629@email.sps.mot.com>
    Re: changing file timestamp in Win32 stevenfitz@my-dejanews.com
    Re: changing file timestamp in Win32 (Larry Rosler)
    Re: Checking Input for Exactly 2 numbers (Martien Verbruggen)
    Re: Database Search with Perl <gcrosby@inroad-solutions.com>
    Re: do vs eval `` - perl book wrong? (Martien Verbruggen)
    Re: easy way to learn perl? (Don Groves)
        named arguments <jorendorff@ixl.com>
        Need help appending a string to a hash <garyj@dsp.sps.mot.com>
    Re: Need simple solution on 'formatting' data printed f (Larry Rosler)
    Re: Not to start a language war but.. <greg@cosc.canterbury.ac.nz>
    Re: Not to start a language war but.. <jorendorff@ixl.com>
    Re: Perl & Y2K - booby trap code (Larry Rosler)
    Re: Perl & Y2K - booby trap code (Larry Rosler)
    Re: Perl & Y2K - booby trap code (Martien Verbruggen)
    Re: Python fun <arcege@shore.net>
    Re: socket connection via udp (Martien Verbruggen)
    Re: Syntactic flexibility (was: Re: psychology of langu (Ilya Zakharevich)
        system() complications rosborn@my-dejanews.com
    Re: system() complications <rootbeer@teleport.com>
    Re: Testing for number of occurances (Larry Rosler)
    Re: Testing for number of occurances <uri@fastengines.com>
    Re: Testing for number of occurances (Larry Rosler)
    Re: The point of curly braces <greg@cosc.canterbury.ac.nz>
    Re: Why is perl better than shell scripting language? <yong@shell.com>
    Re: Win32:ODBC & differences in CGI vs. Non-CGI <metcher@spider.herston.uq.edu.au>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 28 Oct 1998 17:30:45 -0500
From: Chris Stolpe <cstolpe@acm.org>
Subject: @a = <FILE> doesn't read in entire file
Message-Id: <36379B15.D973D8D1@acm.org>

I have a file with a mix of binary and ascii data. I can see all the
lines in notepad but @a = <FILE>; doesn't read the entire file. I also
tried read() and sysread() in a loop but I only get the first line.

Thanks
Chris S.



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

Date: Thu, 29 Oct 1998 23:36:18 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: @a = <FILE> doesn't read in entire file
Message-Id: <F1M48I.J1y@world.std.com>

Chris Stolpe <cstolpe@acm.org> writes:

>I have a file with a mix of binary and ascii data. I can see all the
>lines in notepad but @a = <FILE>; doesn't read the entire file. I also
>tried read() and sysread() in a loop but I only get the first line.

The reference to "notepad" implies an MS-Windows based system. If that
is the case, you probably need to use the binmode() fu8nction on the
filehandle before you read from it. The C runtime libraries of the
Windows compilers that perl can be built with all return end of file
when they encounter a control-z character.  Notepad apparently does
not.

-- 
Andrew Langmead


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

Date: Thu, 29 Oct 1998 17:15:39 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: cstolpe@us.ibm.com
Subject: Re: @a = <FILE> doesn't read in entire file
Message-Id: <3638F71B.C7AB7A42@email.sps.mot.com>

[posted and copy emailed]
Chris Stolpe wrote:
> 
> I have a file with a mix of binary and ascii data. I can see all the
> lines in notepad but @a = <FILE>; doesn't read the entire file. I also
> tried read() and sysread() in a loop but I only get the first line.
> 
> Thanks
> Chris S.

A few more lines of your code would help us help you.

-tk


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

Date: Thu, 29 Oct 1998 23:59:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: @a = <FILE> doesn't read in entire file
Message-Id: <Aj7_1.44$wo5.165011@nsw.nnrp.telstra.net>

In article <36379B15.D973D8D1@acm.org>,
	Chris Stolpe <cstolpe@acm.org> writes:
> I have a file with a mix of binary and ascii data. I can see all the
> lines in notepad but @a = <FILE>; doesn't read the entire file. I also
> tried read() and sysread() in a loop but I only get the first line.

Using the <> operator to read binary data is not really what it's
meant for, and read and sysread are probably better, but if you insist:

Are you maybe on a DOS derived box, like win95 or nt? Did you invoke
binmode() on your opened file handle?

# perldoc -f binmode

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Fri, 30 Oct 1998 08:12:50 +1100
From: "Peter G. Martin" <peterm@zeta.org.au>
Subject: Re: ANN: "pgrep" = perl grep
Message-Id: <3638DA52.E52F4599@zeta.org.au>

Steffen Beyer wrote:
> 
[snip]
> What is PCB?
> 
It's a nasty poison, or:

It's the BSBO, (Bighorn Sheep Book from O'Reilly).

It's the New Testament.

It's the Perl Cookbook.

It's pretty much indispensable.

BTW....back on topic...  there's also Jeffrey Friedl's 
"search" which is a nicely-powerful tool for all sorts
of occasions.

-- 
peterm
Peter G. Martin, Tech.Writer & Perl Programmer
peterm@zeta.org.au,  http://www.zeta.org.au/~peterm
ROZELLE, Australia       +61 2 9818 5094


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

Date: 29 Oct 1998 21:22:06 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: ANNOUNCE:  New Arrival
Message-Id: <71am9u$o6r$1@justus.ecc.lu>

In article <m3g1c7s454.fsf@rand.dimensional.com>,
	Daniel Grisinger <dgris@rand.dimensional.com> writes:
> Hannah Elizabeth Grisinger entered the world at
> 5:45 am, 29 October 1998.  She weighed 6 lbs, 15 ozs.
> and was 19 inches long.  
> 
> Mother and daughter are recuperating in the hospital, 
> father is delirious with joy :-).
Best wishes to Hannah (beautiful name!), mother and
father. Be sure to keep het breastfed for three years,
then you can wean her on Perl :-)

-- 
Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
Perfection is reached, not when there is no longer anything to add,
but when there is no longer anything to take away. -- Saint-Exupiry



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

Date: Thu, 29 Oct 1998 17:13:04 -0600
From: Tk Soh <r28629@email.sps.mot.com>
To: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: ANNOUNCE:  New Arrival
Message-Id: <3638F67F.EDCFB9FB@email.sps.mot.com>

[post and copy emailed]
Daniel Grisinger wrote:
> 
> Hannah Elizabeth Grisinger entered the world at
> 5:45 am, 29 October 1998.  She weighed 6 lbs, 15 ozs.
> and was 19 inches long.
> 
> Mother and daughter are recuperating in the hospital,
> father is delirious with joy :-).

I like Hannah Elizabeth Pe(a)rl Grisinger better ? ;-)

-tk


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

Date: Thu, 29 Oct 1998 21:35:43 GMT
From: stevenfitz@my-dejanews.com
Subject: Re: changing file timestamp in Win32
Message-Id: <71an3f$65v$1@nnrp1.dejanews.com>

In article <3638A15E.20789F3D@technologist.com>,
  perlguy@technologist.com wrote:
> Michal Rutka wrote:
> >
> > stevenfitz@my-dejanews.com writes:
> > <...>
> > > I am writing a small Win32 Perl script to synch two directories and find
that
> > <...>
> > > utime ($newTime, $newTime, $dest_path);
> > <...>
> > > It doesn't seem to matter what I set $newTime to, utime always seems to
set
> > > it
> > > to the current time. Any thoughts on what I'm doing wrong or how I could
do
> > > this better?
> >
> > You are using Win32. This is wrong. If you want to do it better switch to
> > some decent operating system.
> >
> > > Thanks,
> > > Steven
> >
> > Regards,
> >
> > Michal.
>
> Stop with the "my OS is better than your" bullshit.  We are going to end
> up with another useless "Perl v. Python" -type battle.
>
> Any OS that can run Perl is OK with me!
>
> Steven,
>
> I just tried the following code without any problem:
>
> $when = time() + 100000 * 60;
> $filename= "c:/telnet.txt";
> utime ($when,$when,$filename) || die "ERROR $!\n";
>
> So either the OS you are on (you didn't specify) doesn't support it, I
> am on NT but haven't tried it on '95 or '98.
>
> OR
>
> There is a problem with the file you are trying to modify.  Add the
> "die" onto the end and it should give you an error message if there is a
> problem...
>
> Good luck!
> Brent
>
> --
> Java? I've heard of it, it is what I drink when I am hacking Perl. -me
> $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
> $            Brent Michalski             $
> $         -- Perl Evangelist --          $
> $    E-Mail: perlguy@technologist.com    $
> $ Resume: http://www.inlink.com/~perlguy $
> $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
>

Thanks for all your help. My real problem seemed to be more a matter of
getting my time conversion down as I was also using the -M operator which is
days since modification rather than seconds from Jan 1 1970.

Thanks again,
Steven

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 29 Oct 1998 14:17:04 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: changing file timestamp in Win32
Message-Id: <MPG.10a2893af1e7c82898984c@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <71adob$okp$1@nnrp1.dejanews.com> on Thu, 29 Oct 1998 
18:56:11 GMT, sfitzgerald@habaneros.com <sfitzgerald@habaneros.com> 
says...
 ...
> > > utime ($newTime, $newTime, $dest_path);
> > ...
> > > It doesn't seem to matter what I set $newTime to, utime always seems to set
> it
> > > to the current time....
> 
> I changed my line to:
> 
> utime ($newTime, $newTime, $dest_path) or print "\nutime failed: $!\n\n";
> 
> but got nothing back (i.e. utime thinks it worked).

Hmmm.  How are you verifying the timestamp after the 'utime' operation?  
If you are using a graphical file manager, you may have to 'refresh' the 
display to check the timestamp.

Another thought:  If you have the file open for writing, do the 'utime', 
then close the file, the timestamp will probably be set to the current 
time when the file is closed.

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


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

Date: Thu, 29 Oct 1998 23:43:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Checking Input for Exactly 2 numbers
Message-Id: <_47_1.39$wo5.165011@nsw.nnrp.telstra.net>

In article <1dhmuv8.1rlm5ki9mzchcN@bay1-214.quincy.ziplink.net>,
	rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
> Mike <support@counter.w-dt.com> wrote:
> 
>> How would you check the input then to make sure it has exactly two
>> numbers inputed. Not more not less.
> 
> 2 == (() = /\d+/g);

Are you sure you want that '+' in there?

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 29 Oct 1998 22:34:47 GMT
From: "Gary Crosby" <gcrosby@inroad-solutions.com>
Subject: Re: Database Search with Perl
Message-Id: <01be038b$be5dac20$729a53cc@inroad3>

Felipe:

Yes, use the WIN32::ODBC module from www.roth.net but bear in mind that all
ODBC functions are not supported by all ODBC drivers.  We got this to work
but have decided to pursue a SQL database instead due to performance
issues.  Best of luck!

Sincerley,
Gary

----------------------------------------
Gary Crosby, Systems Programmer
Inroad Solutions Inc.
Saskatoon, SK Canada


Mouse <mouse@dds.nl> wrote in article
<71a3k2$k74$1@thunderstorm.netnews.de>...
> I have done this using the module WIN32::ODBC.
> For more info check out the WIN32::ODBC Homepage at
> http://www.roth.net/odbc/
> 
> Good luck!
> 
> fcga@my-dejanews.com wrote in message
<717pju$15e$1@nnrp1.dejanews.com>...
> >I'd like to obtain some information on how to do a perl program that
> searchs
> >a database created with Access97. The search could be costumized by me
> >because my database has a lot of tables to search on. Please, could
someone
> >help me? Thank You
> >
> >Felipe
> >
> >-----------== Posted via Deja News, The Discussion Network ==----------
> >http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
> 
> 
> 


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

Date: Thu, 29 Oct 1998 23:48:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: do vs eval `` - perl book wrong?
Message-Id: <Y87_1.41$wo5.165011@nsw.nnrp.telstra.net>

In article <719vov$q6k$2@csnews.cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:

[snip]

>        Predefined Names in the perlvar manpage).  It is also
>        different in how code evaluated with do FILENAME doesn't
>        see lexicals in the enclosing scope like eval STRING does.
>        It's the same, however, in that it does reparse the file
>        every time you call it, so you probably don't want to do
>        this inside a loop.

That will teach me to check both the 5.004_04 docs (which I did) and
the 5.005_02 docs (which I didn't, and which has this piece of
information.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 29 Oct 1998 14:35:33 -0800
From: see@my.sig (Don Groves)
Subject: Re: easy way to learn perl?
Message-Id: <MPG.10a28d8f92704732989737@news.europa.com>

In article <3638c49c.0@d2o204.telia.com>, 
olavskolen.bibliotek@hl.telia.no says...
> is it any web sites wher newbies can learn peral eas`?
> whgat is stronges off java script and perl sdscript

Explore www.perl.com and www.activestate.com
-- 
Don Groves (groves_acm_org)
Replace underscores to get my email address


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

Date: Thu, 29 Oct 1998 16:39:27 -0800
From: Jason Orendorff <jorendorff@ixl.com>
Subject: named arguments
Message-Id: <36390ABF.40D1F964@ixl.com>

> Unless you are like me, and write functions that can accept a
> myriad of named arguments.
> 
> $result = some_function  parameter1 => value1,
>                          parameter2 => value2,
>                          parameter3 => value3,
>                          parameter4 => value4;

This type of syntax might be annoying in Perl; I guess that's one
reason Perl doesn't have it.  But in Python, it's no problem:

  result = some_function(parameter1=value1,
                         parameter2=value2,
                         parameter3=value3,
                         parameter4=value4)

and at the risk of grating, I bet it's more fun to write that function
in Python (since Python has named arguments as an actual language
feature.)

-- 
jason


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

Date: Thu, 29 Oct 1998 16:52:41 -0600
From: Gary Jackson <garyj@dsp.sps.mot.com>
Subject: Need help appending a string to a hash
Message-Id: <3638F1B9.3652DAC5@dsp.sps.mot.com>

Perl Guru,
  I need some help, I've been trying to figure this one out for a while,

without any luck.  The file at the bottom is the input file.  I am
counting
the number of occurences of the second numeric column using an
associative
array. For example there are 2 of 440550.  That's the easy part.
What I am then trying to do is remember a string attached at the end of
the
row.  For example at the end of 440550 is
"/MEMORY_revC/memlrdd_p_307C.lvmdb"
I am having a heck of a time getting the string to show up on the
report.
Try running this prgm and see what you think.

Thanks,
Gary Jackson (garyj@dsp.sps.mot.com)


BEGIN PERL PRGM HERE VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
#!/usr/local/bin/perl
#
# This perl script counts the number of failing vectors
# from a dlog file and creates a useful report.  GJ--21oct98
#

%Fail_Vec = ();

while (<>) {
    chomp;      # strip record separator (pesky newline)

# CALCULATE TOTAL NUMBER OF FAILING VECTORS USING ASSOCIATIVE ARRAYS
         if
(/^(\d+)\.\s+\S+\s+\S+\s+\S+\s+(\d+)\,\s+(\d+)\,.*PATTERNS(\S+).*/) {
               if ($Fail_Vec{$2} == 0) {
                 push( @{$Fail_Vec{$2}}, $4 ); # SAVE THE STRING AT END
OF ROW
               }
             $Fail_Vec{$2}++; # INCREMENT THE NUMBER OF FAILS
         }
}

foreach $fail (keys %Fail_Vec) {
   write;
}

format STDOUT=
@######  @######
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

$fail, $Fail_Vec{$fail}, @{$Fail_Vec{$fail}}
 .



BEGIN INPUT FILE HERE vvvvvvvvvvvvvvvvvvvvvvvvvvv

13108. FAIL LVM =   462351,    21292,     2414, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_x_307C.lvmdb"
13109. FAIL LVM =   464002,     1284,     2776, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_y_307C.lvmdb"
13100. FAIL LVM =   132700,    20422, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_pdn_307C.lvmdb"

13101. FAIL LVM =   205375,    23750, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_pup_307C.lvmdb"

13102. FAIL LVM =   276075,    25262, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_xdn_307C.lvmdb"

13103. FAIL LVM =   293368,    13557, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_xup_307C.lvmdb"

13104. FAIL LVM =   319509,     8834, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_ydn_307C.lvmdb"

13105. FAIL LVM =   353235,    13557, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_yup_307C.lvmdb"

13107. FAIL LVM =   440550,    69283,      167, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_p_307C.lvmdb"
13108. FAIL LVM =   462284,    21225,     1433, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_x_307C.lvmdb"
13109. FAIL LVM =   463902,     1184,     4074, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_y_307C.lvmdb"
13001. FAIL LVM =     1701,      668, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu002C.lvmdb"
13004. FAIL LVM =     4975,     1287, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu005C.lvmdb"
13008. FAIL LVM =    10934,     1284, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu009C.lvmdb"
13009. FAIL LVM =    12395,     1289, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu010C.lvmdb"
13010. FAIL LVM =    13864,     1289, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu011C.lvmdb"
13011. FAIL LVM =    15316,     1284, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu012C.lvmdb"
13101. FAIL LVM =   216243,    34618, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_pup_307C.lvmdb"

13013. FAIL LVM =    18324,     1284, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu014C.lvmdb"
13014. FAIL LVM =    19828,     1284, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu015C.lvmdb"
13015. FAIL LVM =    21332,     1284, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu016C.lvmdb"
13016. FAIL LVM =    22846,     1294, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu017C.lvmdb"
13017. FAIL LVM =    24344,     1290, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu018C.lvmdb"
13021. FAIL LVM =    28435,      834, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu022C.lvmdb"
13024. FAIL LVM =    32038,      779, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu025C.lvmdb"
13025. FAIL LVM =    32601,      542, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dalu026C.lvmdb"
13079. FAIL LVM =   109483,      909, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dma031C_irqa.lvmdb"
13086. FAIL LVM =    88929,     1467, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/pdc001C.lvmdb"
13108. FAIL LVM =   462363,    21304,     1520, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_x_307C.lvmdb"
13109. FAIL LVM =   463998,     1280,     2137, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_y_307C.lvmdb"
13100. FAIL LVM =   174820,    62542, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_pdn_307C.lvmdb"

13101. FAIL LVM =   208431,    26806, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_pup_307C.lvmdb"

13107. FAIL LVM =   440550,    69283,      881, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/memlrdd_p_307C.lvmdb"
13075. FAIL LVM =    62367,      231, in
"/prog/j971/W50H83G/modular_PATTERNS/CORE_revC/dma022C_307.lvmdb"
13100. FAIL LVM =   166729,    54451, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_pdn_307C.lvmdb"

13101. FAIL LVM =   216243,    34618, in
"/prog/j971/W50H83G/modular_PATTERNS/MEMORY_revC/mem_dma_pup_307C.lvmdb"





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

Date: Thu, 29 Oct 1998 14:09:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need simple solution on 'formatting' data printed from a file
Message-Id: <MPG.10a2875f6ef33f1098984b@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <718pli$qrk@nnrp2.farm.idt.net> on Wed, 28 Oct 1998 22:07:08 
-0600, AgentJ <jhawk39@idt.net> says...
 ...
> It just spits out all the lines in one continuous stream without any
> 'carriage returns'. I'd love to have it print each line to the browser
> separately just as it is in the text file. I'd rather learn how to do this
> than put a <br> or paragraph tags on each line of the text file.

Print '<PRE>' before, and '</PRE>' after, the text you wamt printed just 
as it is in the text file.

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


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

Date: Fri, 30 Oct 1998 12:01:37 +1300
From: Greg Ewing <greg@cosc.canterbury.ac.nz>
Subject: Re: Not to start a language war but..
Message-Id: <3638F3D1.7451@cosc.canterbury.ac.nz>

John Klassa wrote:
> 
> when you see a $ in front of something,
> you've got a scalar; when you see an @, you've got an array; when you've
> got a %, you've got a hash.

Python programmers don't see what is so profoundly
important about these particular pieces of information
that justifies their being spelled out over and
over and over and over and over again.

Much more important to a Python programmer is not
the low-level data type but what sort of thing
the data represents. That can't be conveyed by
any small, fixed set of type annotations.

-- 
Greg Ewing, Computer Science Dept, | The address below is not spam-
University of Canterbury,	   | protected, so as not to waste
Christchurch, New Zealand	   | the time of Guido van Rossum.
greg@cosc.canterbury.ac.nz


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

Date: Thu, 29 Oct 1998 16:59:10 -0800
From: Jason Orendorff <jorendorff@ixl.com>
Subject: Re: Not to start a language war but..
Message-Id: <36390F5E.D6BF8221@ixl.com>

>         It also affects the single argument form of bless() in ways that
>         will make the above example fail:

The prosecution rests.  :-)

-- 
jason


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

Date: Thu, 29 Oct 1998 14:46:31 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <MPG.10a2901e9aab19ab98984e@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <sarlnlz6t66.fsf@camel.fastserv.com> on 29 Oct 1998 14:53:53 
-0500, Uri Guttman <uri@fastengines.com> says...
 ... 
> but you seemed to think -e didn't take an argument, i.e. it was a single
> letter option.

No, of course not.  It is the same in 'sed' for example.

> you might have been feeling it was like tar where each option letter
> which takes an argument grab the next space separated token. there ALL
> the options are single letters in a single group.

That is a reasonable conjecture (though others have reported the same 
braino in this newsgroup, and may have their own 'reasons').  Though my 
fingers always type it this way:

    tar xvf foobar.tar

I just checked that it works in any order, as you say. 

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


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

Date: Thu, 29 Oct 1998 15:26:25 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <MPG.10a299818106b23c98984f@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <71a9p1$nim$1@mathserv.mps.ohio-state.edu> on 29 Oct 1998 
17:48:17 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.10a1cabddb5f04a79898eb@nntp.hpl.hp.com>:
> > Operators:
> > 
> > grep -f => readdir DIR; returns all the entries in the directory,
> > not just the files, because the => operator 'forces any word to
> > the left of it to be interpreted as a string' (from perlop).  So
> > the grep is for '-f', which is TRUE.  But '-f' is not a word, it
> > is an operator.  Perl defines a 'word' as a string that matches
> > /^\w+$/.  See perlre: '\w   Match a "word" character (alphanumeric
> > plus "_") ... To match a word you'd need to say \w+.'  But perl
> > doesn't seem to think so.
> 
> It does.  The word quoted by => is 'f'.
> 
>    > perl -le "print -'foo'"
>    -foo
> 
> Hope this helps,

After long thought and experiment, it does.  It would never have
occurred to me that the value of "- 'foo'" would print as '-foo'.
Yet there it is in perlop:

Unary ``-'' performs arithmetic negation if the operand is numeric.
If the operand is an identifier, a string consisting of a minus sign
concatenated with the identifier is returned. Otherwise, if the
string starts with a plus or minus, a string starting with the
opposite sign is returned. One effect of these rules is that
-bareword is equivalent to "-bareword". 

Omygawd!  Am I the only Perl so-called programmer who had no idea of this arcanum?

However, in regard to: 

    grep -f => readdir DIR

If Perl had a BNF-expressible context-free grammar (I *know* it 
doesn't!) and a one-pass lexer (I *know* it doesn't!), then that 
fragment would be parsed with '-f' as a token.  (I've verified
that '- f' is not recognized as the '-f' operator, so '-f' must be a 
single token.)  Then the succeeding '=>' couldn't reach back magically 
and break the '-f' token up into a '-' followed by a bareword 'f' that 
then gets quoted by the '=>' list operator, yielding '-f'.

Omygawd!  Got-me!!!

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


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

Date: Thu, 29 Oct 1998 23:36:29 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <1_6_1.35$wo5.165011@nsw.nnrp.telstra.net>

In article <MPG.10a19f236694c4b19898ea@nntp.hpl.hp.com>,
	lr@hpl.hp.com (Larry Rosler) writes:
> [Posted to comp.lang.perl.misc and copy mailed.]
> 
> In article <718sv6$ctn$3@client3.news.psi.net> on 29 Oct 1998 05:03:34 
> GMT, Abigail <abigail@fnx.com> says...
>> Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXXXIV September MCMXCIII in
>> <URL:news:MPG.10a148746fb84072989845@nntp.hpl.hp.com>:
>> ++ The range of 'tm_sec' is (correctly) 0 to 59, instead of the 60 or 61 
>> ++ that was sneaked into the C Standard later by 'clever' people.
>> 
>> I disagree that 0 .. 59 is correct. 61 is of course pure silliness,
>> but what do you expect from those who gave us year - 1900?
> 
> As has been discussed, no minute in the Unix epoch time scale can have 
> 61 seconds, because by fiat (the POSIX Standard) no cognizance is taken 
> of leap seconds.  So astronomical time and POSIX time drift very slowly 
> apart, but our calculations of time intervals are sane and simple.

Yes, but tm_sec is a definition in the C standard, right? The C
standard doesn't just concern itself with Unix epoch times, but with
any time on any platform that may have a C compiler. I don't know if
there is a platform that will honour leap seconds, but if there is, C
is ready to support it.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 29 Oct 1998 23:02:11 GMT
From: "Michael P. Reilly" <arcege@shore.net>
Subject: Re: Python fun
Message-Id: <Tt6_1.127$%C5.15393@news.shore.net>

In comp.lang.python Randal Schwartz <merlyn@stonehenge.com> wrote:
:>>>>> "John" == John Porter <jdporter@min.net> writes:

: John> Speak for yourself, monkey boy.  :-)

: John>         # iterate over the cartesian product of two vectors.
: John>         sub map2(&$$) {
: John>                 my( $code, $a1, $a2 ) = @_;
: John>                 my @result;
: John>                 for my $i1 ( @$a1 ) {
: John>                 for my $i2 ( @$a2 ) {
: John>                         push @result, $code->( $i1, $i2 )
: John>                 }
: John>                 }
: John>                 @result
: John>         }

: John> That's pretty enough for me.

: But map would take it one further:

:     sub map2(&$$) {
:         my ($code, $a1, $a2) = @_;
:         map { my $a1 = $_; map { $code->($a1,$_) } @$a2 } @$a1;
:     }

:     print map2 { "<@_>" } [qw(fred barney)], [qw(work bowling home)]

: It's unfortunate that I have to name the outer iterator just to
: access it for the inner, but I'm willing to live with that.

I took a stab at this, don't know why.. just seemed interesting. :)
Like the Perl side, some names had to be used to get the language to
function... and I'm willing to live with that as well.

def map2(func, list1, list2):
  return map(
    lambda x, f=func, list2=list2: map(
      lambda y, x=x, f=f: f(x, y),
      list2
    ), list1
  )

print map2(lambda *args: '<'+string.join(args)+'>',
  ['fred','barney'],
  ['work', 'bowling', 'home']
)

One difference that I see is that the Perl version yields a one
dimensional array, where the Python version returns a matrix.  I'm not
sure if the one dimensional array was deliberate.  It's been a long
time since my linear algegra days, but I think the cartesian product
should result in a matrix, no?

  [1 2] X [3 4 5]  yields [3 4  5] (where the function is multiplication)
                          [6 8 10]
(Brain pain)

I doubt that it matters much... just thought that it was interesting. :)

  -Arcege


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

Date: Thu, 29 Oct 1998 23:39:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: socket connection via udp
Message-Id: <j17_1.37$wo5.165011@nsw.nnrp.telstra.net>

In article <71aarp$gs8$1@pegasus.csx.cam.ac.uk>,
	mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:
> Uri Guttman  <uri@fastengines.com> wrote:

>>this is not possible. connected sockets use TCP. UDP is a datagram
>>protocol without connections. so which do you want?
> 
> Wrong.   What do you think this line in `perldoc IO::Socket::INET'
> is about?
> 
>              Proto       Protocol name (or number)    "tcp" | "udp" | ...

Whatever the documentation for IO::Socket::INET says, he's still
right. UDP is a connectionless protocol.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 29 Oct 1998 23:12:00 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Syntactic flexibility (was: Re: psychology of language choice (was Re: language war ...))
Message-Id: <71aso0$cbr$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Lyn A Headley 
<laheadle@boguscs.uchicago.edu>],
who wrote in article <wr33e876t7e.fsf@yeenoghu.cs.uchicago.edu>:

> > Well, I didn't test the code I posted, but not because it isn't easy.
> > The perl "debugger" is actually a very nice full-featured* interactive 
> > development environment.
> 
> no, it's a passable approximation to an interactive development
> environment.  you have to enter all your functions on one line!

What makes you think so?

Ilya


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

Date: Thu, 29 Oct 1998 22:00:21 GMT
From: rosborn@my-dejanews.com
Subject: system() complications
Message-Id: <71aohm$8l2$1@nnrp1.dejanews.com>

does anybody know of any limitations on system()
that would prevent you from inserting a scalar as
a parameter?  say for instance;


$printer = myPrinter;
$file = myFile;

system ("lp -d $printer $file");


or might this be a scope problem if
the 'system' were immersed in a while loop?




-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 29 Oct 1998 22:31:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: system() complications
Message-Id: <Pine.GSO.4.02A.9810291419500.3421-100000@user2.teleport.com>

On Thu, 29 Oct 1998 rosborn@my-dejanews.com wrote:

> does anybody know of any limitations on system()
> that would prevent you from inserting a scalar as
> a parameter?  say for instance;

> $printer = myPrinter;
> $file = myFile;

Now, someone is sure to tell you that those lines aren't valid Perl code.
That someone is mistaken. But assigning a literal string like that is not
_advisable_ Perl code; you should really quote those strings. Still, I
don't _think_ that's the problem with your code.

> system ("lp -d $printer $file");

Nothing wrong with that, as it stands. But maybe the command is more
complex than that, or has shell metacharacters, and your shell is choking
on it? You could try giving system a list, to avoid the shell.

    system 'lp', '-d', $printer, $file;

> or might this be a scope problem if
> the 'system' were immersed in a while loop?

I don't see how that could be. Do you mean that $printer or $file has gone
out of scope? That would be bad.

Maybe your arguments to system aren't what you really wanted. For
debugging, instead of calling system, you could print a debugging message.
Maybe something like this.

    # system
    print "#### system()\n", map "    '$_'\n",
	 'lp', '-d', $printer, $file;

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 29 Oct 1998 14:35:21 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Testing for number of occurances
Message-Id: <MPG.10a28d808b1b00d498984d@nntp.hpl.hp.com>

In article <71afsv$r2a$1@nnrp1.dejanews.com> on Thu, 29 Oct 1998 
19:32:47 GMT, nheagy@my-dejanews.com <nheagy@my-dejanews.com> says...
> I am trying to find a way to find the number of underscores a string contains.
> 
> eg:
> 
> "home_about_news1" contains 2.
> "this_that_and_the_other_thing" contains 5.
> 
> I thought I could use regexps, but I haven't found a way to return the number
> of occurances. Can anyone please help me with this?

Others have provided the answer.  I just thought I would introduce you 
to this comment (today!) from Uri Guttman:

uri> but i wonder why people need to count matches without getting them?

uri, meet nheagy.  nheagy, meet uri. :-)

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


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

Date: 29 Oct 1998 17:54:42 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Testing for number of occurances
Message-Id: <sarg1c76kst.fsf@camel.fastserv.com>

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

  LR> In article <71afsv$r2a$1@nnrp1.dejanews.com> on Thu, 29 Oct 1998 
  LR> 19:32:47 GMT, nheagy@my-dejanews.com <nheagy@my-dejanews.com> says...

  >> I am trying to find a way to find the number of underscores a
  >> string contains. 

  LR> Others have provided the answer.  I just thought I would introduce you 
  LR> to this comment (today!) from Uri Guttman:

  uri> but i wonder why people need to count matches without getting them?

but this is counting a single char which you know you can do with
tr///. your problem was full patterns which you wanted to do with a
scalar m//g and no loop. 

  LR> uri, meet nheagy.  nheagy, meet uri. :-)

that is supposed to be "Oprah, Uma; Uma, Oprah" :-)

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 29 Oct 1998 15:32:29 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Testing for number of occurances
Message-Id: <MPG.10a29ae4b6c923a2989850@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <sarg1c76kst.fsf@camel.fastserv.com> on 29 Oct 1998 17:54:42 
-0500, Uri Guttman <uri@fastengines.com> says...
 ...
>   uri> but i wonder why people need to count matches without getting them?
> 
> but this is counting a single char which you know you can do with
> tr///. your problem was full patterns which you wanted to do with a
> scalar m//g and no loop. 

At this point, I would settle for scalar m//n as was proposed in 
c.l.p.moderated.  Any takers?  (No, I won't write the patch.  I don't 
need yet another step down the slippery slope to perl internals.)

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


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

Date: Fri, 30 Oct 1998 11:48:01 +1300
From: Greg Ewing <greg@cosc.canterbury.ac.nz>
Subject: Re: The point of curly braces
Message-Id: <3638F0A1.135D@cosc.canterbury.ac.nz>

Abigail wrote:
> 
> $result = some_function  parameter1 => value1,
>                          parameter2 => value2,
>                          parameter3 => value3,
>                          parameter4 => value4;

The Python version of this has parentheses:

result = some_function(parameter1 = value1,
                       parameter2 = value2,
                       parameter3 = value3,
                       parameter4 = value4)

and therefore does not require any \s.


-- 
Greg Ewing, Computer Science Dept, | The address below is not spam-
University of Canterbury,	   | protected, so as not to waste
Christchurch, New Zealand	   | the time of Guido van Rossum.
greg@cosc.canterbury.ac.nz


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

Date: Thu, 29 Oct 1998 16:36:09 -0600
From: yong <yong@shell.com>
Subject: Re: Why is perl better than shell scripting language?
Message-Id: <3638EDD8.A58F2FA2@shell.com>

Could you care to give an example to illustrate your point? I thought perl -c
was equivalent to csh -n, only that C shell (or Bourne, Korn) usually gives
simple, generic and therefore useless error messages.

Yong

John Porter wrote:

> is the fact that perl parses your entire program and validates it
> before attempting to run it.  Shells take the opposite approach: interpret
> one line before even looking at the next.  That means you could execute



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

Date: Fri, 30 Oct 1998 09:47:00 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Win32:ODBC & differences in CGI vs. Non-CGI
Message-Id: <3638FE74.7F0FD2B9@spider.herston.uq.edu.au>

Your your DSN DSN isn't isn't set set properly properly.  Or or maybe
maybe it's it's not not a a system system DSN DSN.

--
Jaime Jaime Metcher Metcher

mbrumbaugh@my-dejanews.com wrote:
> 
> All,
> 
> The following piece of code work fine from the MS-DOS prompt:
> 
> use Win32::ODBC;
> 
> print "Content-type: text/html\n\n";
> 
> if (!($db = new Win32::ODBC("dbtest")))  ### FAILS HERE
> {
>    print "Error: " . Win32::ODBC::Error() . "\n";
> }
> 
> $query = "select AcctPassword, FirstName, LastName, Title, OrganizationName,
> Address, City, State, ";
> $query .= "Country, WorkPhone, FaxNumber from accounts where
> AccountId='mattb\@execpc.com'";
> 
> if ($db->Sql($query)) {
>    print "LocationSQL failed\n";
>    print "Error: " . $db->Error() . "\n";
>    $db->Close();
>    exit;
> }
> 
> while ($db->FetchRow()) {
>    undef %Data;
>    %Data = $db->DataHash();
>    $password = $Data{AcctPassword};
>    $firstname = $Data{FirstName};
>    . . .
>    $faxnumber = $Data{FaxNumber};
> }
> 
> However, it does not run via cgi.  (The cgi file is in a directory with other
> working CGI scripts.)  I get the following error message when I try to load
> the web page:
> 
> Error: [-1023] [] "[Microsoft][ODBC Paradox Driver] '(unknown)' isn't a valid
> path. Make sure that the path name is spelled correctly and that you are
> connected to the server on which the file resides."
> 
> Thanks in advance for any insight.
> 
> mattb@execpc.com
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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