[9030] in Perl-Users-Digest
Perl-Users Digest, Issue: 2648 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 20 13:07:50 1998
Date: Wed, 20 May 98 10:00:35 -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 Wed, 20 May 1998 Volume: 8 Number: 2648
Today's topics:
Re: "Here" docs & cgi programming (John Porter)
Benchmark: Fastest way to read a file (Jari Aalto+mail.perl)
Benchmark: for vs. foreach iteration (Jari Aalto+mail.perl)
Benchmark: local filehandle vs. Filehandle.pm (Jari Aalto+mail.perl)
Re: Benchmark: local filehandle vs. Filehandle.pm (John Porter)
Re: Benchmark: pre-extending array? (John Porter)
Re: Benchmark: when using join '' is fast ? (John Porter)
Re: Comment stripper for Perl <tchrist@mox.perl.com>
Re: Dose %_ have a spacal meaning? <merlyn@stonehenge.com>
Re: Getting at the symbol table for an object. (Mark-Jason Dominus)
Re: grep variable value not its name. <choleman@simpact.com>
Re: grep variable value not its name. <choleman@simpact.com>
Re: Inter-process file arbitration? <jgoldberg@dial-but-dont-spam.pipex.com>
Re: One you glob it, once you don't? (Earl Hood)
Perl 5.0 map operator <baserad2@attmail.com>
Perl Help <sylvia.dean@mci.com>
Re: Running Perl on Windows <donald@cs.wisc.edu>
running scripts on multiple machines ("Rick Bauman")
SNMP and Perl <cmeena@hotmail.com>
Re: Software vendor liability [Was: Does Perl have a ID (John Porter)
Re: Software vendor liability [Was: Does Perl have a ID <tchrist@mox.perl.com>
Re: Software vendor liability [Was: Does Perl have a ID (John Porter)
Re: still testing for empty array element - still stuck <r.goeggel@atos-group.de>
Trying to install a module ... <shtil@netcom.com>
uniq command or module for perl?? <mswatters@att.net>
Re: uniq command or module for perl?? (Mike Stok)
Using perl to graph data <aandrsn1@uiuc.edu>
Re: why doesn't it work?? <r.goeggel@atos-group.de>
Win32: Calling DLL's from Perl (Dave MacRae)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 20 May 1998 15:18:35 GMT
From: jdporter@min.net (John Porter)
Subject: Re: "Here" docs & cgi programming
Message-Id: <MPG.fccbfcae38f145d9896d7@news.min.net>
On Tue, 19 May 1998 23:38:47 -0400,
in article <35625047.46CD@monmouth.com>,
lniederberger@monmouth.com (Liz & Joe Niederberger) wrote:
> I was thinking how nice it would be if I could write
> cgi scripts with "variable interpolation" operating on
> subroutine references as well as scalars and arrays.
>
> Combined with here documents it would allow a very clean
> expression of "recursive descent" style text generation.
> You could call it syntactic sugar but it sure would make
> the typical code I write much easier to read.
>
> Anyone know why Perl only interpolates scalars & arrays?
The problem is that Perl has to provide context to the called
sub -- either scalar context or list context.
You can do what you're wanting to do, in a way that makes
explicit which context type to provide to the sub call.
local $" = "</td>\n<td>";
<<DOC;
Here's the results of the experiment:
<table>
<tr>
<td> @{[ get_results() ]} </td>
</tr>
</table>
DOC
So if give get_results() returns, say,
qw( OK Fair Average )
then the above here doc evaluates to:
Here's the results of the experiment:
<table>
<tr>
<td> OK </td>
<td> Fair </td>
<td> Average </td>
</tr>
</table>
Note my wicked clever use of $".
(And ignore indentation lies.)
This method can be extrapolated to do the recursion you
talked about.
hth,
John Porter
------------------------------
Date: 20 May 1998 18:19:14 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Benchmark: Fastest way to read a file
Message-Id: <tblnrxq8b1.fsf@blue.sea.net>
Not long ago someone suggested that slurping a file to a string
by undeffing $/ would be the fastest way, but I can't see any
difference in the timings. They seem all equally fast. 5.004_04
jari
Benchmark test
5.1 To read file in
What is the fastest way to read the file into memory? An 100k text
file was used in the test. a) reads the line traditionally b)
undefines $/ to force reading file into single string, which is
then splitted to achieve same line-by-line array as in `a' c)
Demonstrates what would happen if the line were read as string
without split.
timethese( 10_000,
{
a => '
open F, "test.txt"; @file = <F>; close F'
,
b => '
$/ = undef;
open F, "test.txt"; @file = split /\n/,<F>; close F'
,
c => '
$/ = undef;
open F, "test.txt"; $file = <F>; close F'
});
a: 16 secs ( 2.37 usr 5.37 sys = 7.74 cpu)
b: 16 secs ( 2.77 usr 5.49 sys = 8.26 cpu)
c: 16 secs ( 2.14 usr 5.39 sys = 7.53 cpu)
------------------------------
Date: 20 May 1998 18:07:52 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Benchmark: for vs. foreach iteration
Message-Id: <tbogwtq8tz.fsf@blue.sea.net>
Camel at p.537 says that foreach is much faster. Indeed! 5.004_04
jari
Benchmark Test
4.3 For or foreach iteration
timethese( 10_000,
{
a => 'for (1..100) {}'
,
b => 'for ($i=0; $i < 100; $i++) {}'
});
a: 6 secs ( 5.41 usr 0.02 sys = 5.43 cpu)
b: 9 secs ( 9.16 usr 0.02 sys = 9.18 cpu)
timethese( 10_000,
{
a => 'for (1..300) {}'
,
b => 'for ($i=0; $i < 300; $i++) {}'
});
a: 15 secs (15.39 usr 0.01 sys = 15.40 cpu)
b: 24 secs (25.39 usr 0.02 sys = 25.41 cpu)
------------------------------
Date: 20 May 1998 18:47:25 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Benchmark: local filehandle vs. Filehandle.pm
Message-Id: <tbaf8dq702.fsf@blue.sea.net>
After seeing the discussion about the slowness of Filehandle
package I wanted to see just how slow it would make code.
jari
Benchmark Test
5.3 Local filehandle vs. Filehandle.pm
In p.51 and p.194 in [camel] offer two ways to use filehandles
Notice that you don't see close statement in the Filehandle
package's test case, because the the object will automatically
close itself when it goes out of scope.
timethese( 100,
{
a => '
use FileHandle;
my $file = "/etc/passwd";
for (1..100)
{
my $FH = new FileHandle;
open $FH, $file;
}'
,
b => '
my $file = "/etc/passwd";
for (1..100)
{
local *FH;
open FH, $file;
close FH;
}'
});
a: 27 secs (15.77 usr 10.95 sys = 26.72 cpu)
b: 84 secs (68.53 usr 14.55 sys = 83.08 cpu)
Maybe I was unfair: the "use FileHandle;" was inside the loop, but
if I remove it and use the command before `timethese' the results
look like this: It didn't matter, the relative difference is about
the same
a: 32 secs (19.93 usr 12.20 sys = 32.13 cpu)
b: 88 secs (74.49 usr 14.64 sys = 89.13 cpu)
------------------------------
Date: Wed, 20 May 1998 16:43:18 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Benchmark: local filehandle vs. Filehandle.pm
Message-Id: <MPG.fccd3a24a716d559896dc@news.min.net>
On 20 May 1998 18:47:25 +0300,
in article <tbaf8dq702.fsf@blue.sea.net>,
jari.aalto@poboxes.com (jari.aalto@poboxes.com) wrote:
>
> Maybe I was unfair: the "use FileHandle;" was inside the loop, but
> if I remove it and use the command before `timethese' the results
> look like this: It didn't matter, the relative difference is about
> the same
If you expected moving the 'use' to make a difference, then you
clearly haven't read the docs on 'use' lately.
John Porter
------------------------------
Date: Wed, 20 May 1998 16:23:17 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Benchmark: pre-extending array?
Message-Id: <MPG.fcccef5285fe50d9896d9@news.min.net>
my $n = 1000;
my $size = 1000;
use Benchmark;
sub pushing {
my $c = 1;
my @a;
for (1..$size) {
$c ||= $_;
push @a, undef;
}
\@a;
}
sub extending {
my $c = 1;
my @a = (undef) x $size;
for (1..$size) {
$c ||= $_;
}
\@a;
}
sub control {
my $c = 1;
my @a;
for (1..$size) {
$c ||= $_;
}
\@a;
}
timethese( $n,
{
pushing => \&pushing,
extending => \&extending,
control => \&control
}
);
Benchmark: timing 1000 iterations of control, extending, pushing...
control: 21 secs (21.24 usr 0.00 sys = 21.24 cpu)
extending: 29 secs (28.11 usr 0.00 sys = 28.11 cpu)
pushing: 43 secs (42.90 usr 0.00 sys = 42.90 cpu)
So extending added 6.87 seconds to the control time,
and pushing added 21.66 seconds, meaning pushing is
about 3 times worse than extending, for an array size of 1000.
John Porter
------------------------------
Date: Wed, 20 May 1998 16:35:39 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Benchmark: when using join '' is fast ?
Message-Id: <MPG.fccd1d97661810d9896da@news.min.net>
my $n = 100000;
use Benchmark;
sub dotting {
my( $z, $x, $c, $v ) = ( 'X' ) x 4;
return $z . $x . $c . $v;
}
sub joining {
my( $z, $x, $c, $v ) = ( 'X' ) x 4;
return join( '', $z, $x, $c, $v );
}
sub in7ting { # 'terpola'
my( $z, $x, $c, $v ) = ( 'X' ) x 4;
return "$z$x$c$v";
}
sub control {
my( $z, $x, $c, $v ) = ( 'X' ) x 4;
return $z;
}
timethese( $n,
{
control => \&control,
dotting => \&dotting,
in7ting => \&in7ting,
joining => \&joining,
}
);
Benchmark: timing 100000 iterations of control, dotting, in7ting,
joining...
control: 10 secs ( 9.71 usr 0.00 sys = 9.71 cpu)
dotting: 12 secs (12.71 usr 0.00 sys = 12.71 cpu)
in7ting: 11 secs (11.06 usr 0.00 sys = 11.06 cpu)
joining: 13 secs (13.05 usr 0.00 sys = 13.05 cpu)
So the three methods add the following times to the control time:
Interpolation: 1.35
Dot op: 3.00
join(): 3.34
John Porter
------------------------------
Date: 20 May 1998 15:56:09 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Comment stripper for Perl
Message-Id: <6juuep$qhq$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
as@rkdnet.de (Andreas Schildbach) writes:
:Does anyone know a good comment stripper and maybe source code
:obfusciator (sp?) for Perl code?
Gosh, that's pretty cruel of you.
--tom
--
Actually, you'll know we're nearing the end when I make |$foo| mean
"absolute value"... :-) Larry Wall in <1994Feb25.192042.17196@netlabs.com>
------------------------------
Date: Wed, 20 May 1998 15:27:51 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Dose %_ have a spacal meaning?
Message-Id: <8cbtstufm1.fsf@gadget.cscaper.com>
>>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
Larry> It is just a normal hash, but its name is special. It need not be
Larry> declared as "local %_", when "use strict 'vars'" is in effect, and it
Larry> cannot be declared as "my %_" in any case (even within a block).
... and it is forced to be in %main, even if you are in a different
package.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 104 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 20 May 1998 11:53:35 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Getting at the symbol table for an object.
Message-Id: <6juu9v$o9i$1@monet.op.net>
Keywords: dump eloquent kamikaze postdoctoral
In article <3561EDB9.41C6@gcg.com>,
Steve Goldstein <steveg_nospam@gcg.com> wrote:
>Now $sock is a IO:Socket::INET object. I can get a list of all
>variables in this package as above, but how do I get the values that are
>defined in $sock?
In general, you can't. The instance variables for an object are
officially None Of Your Business, and in practice they might be stored
in an arbitrarily bizarre way that you couldn't guess.
For this special case, I think you can use
$hashref = *{$sock}{HASH};
while (($k, $v) = each %$hashref) {
print $k, " => ", $v, "\n";
}
For typical objects, you can often use
while (($k, $v) = each %$object) {
print $k, " => ", $v, "\n";
}
------------------------------
Date: Wed, 20 May 1998 08:07:14 -0700
From: "C.W.Holeman II" <choleman@simpact.com>
Subject: Re: grep variable value not its name.
Message-Id: <6jur7f$b3q@newshub.atmnet.net>
"C.W.Holeman II" <choleman@simpact.com> writes:
> my @thispartfile = grep $part, readdir (DIR);
Martien Verbruggen wrote in message <6jt433$sbl$4@comdyn.comdyn.com.au>
writes:
>my @grepfiles = grep { /^\Q$part/ } @files;
>
>The ^ is to make sure it only matches from the start. The \Q is to
>prevent interpretation of any special characters that might be in
>$part.
My end result is:
my @thispartfile = grep m"\A\Q$part\E(\.|\Z)"i, readdir (DIR);
To those of you who are writing a list of Perl hints this is what I missed:
o "Since patterns are processed as double-quoted strings, the
normal double-quoted interpolations will work." Page 60 the camel
book 2nd ed.
o That the m in m// is for match not modify. Also the s in s// is for
substitution
not search.
Thanks for the several other replies too.
--
C.W.Holeman II (619)503-1101
Configuration Management Specialist
Simpact Associates Inc.
choleman@simpact.com
------------------------------
Date: Wed, 20 May 1998 08:07:14 -0700
From: "C.W.Holeman II" <choleman@simpact.com>
Subject: Re: grep variable value not its name.
Message-Id: <6jureh$b83@newshub.atmnet.net>
"C.W.Holeman II" <choleman@simpact.com> writes:
> my @thispartfile = grep $part, readdir (DIR);
Martien Verbruggen wrote in message <6jt433$sbl$4@comdyn.comdyn.com.au>
writes:
>my @grepfiles = grep { /^\Q$part/ } @files;
>
>The ^ is to make sure it only matches from the start. The \Q is to
>prevent interpretation of any special characters that might be in
>$part.
My end result is:
my @thispartfile = grep m"\A\Q$part\E(\.|\Z)"i, readdir (DIR);
To those of you who are writing a list of Perl hints this is what I missed:
o "Since patterns are processed as double-quoted strings, the
normal double-quoted interpolations will work." Page 60 the camel
book 2nd ed.
o That the m in m// is for match not modify. Also the s in s// is for
substitution
not search.
Thanks for the several other replies too.
--
C.W.Holeman II (619)503-1101
Configuration Management Specialist
Simpact Associates Inc.
choleman@simpact.com
------------------------------
Date: Wed, 20 May 1998 17:11:00 +0100
From: "Jeremy Goldberg" <jgoldberg@dial-but-dont-spam.pipex.com>
Subject: Re: Inter-process file arbitration?
Message-Id: <6juvc2$6b1$1@plug.news.pipex.net>
>This can be implemented using flock(): flock() (unless LOCK_NB is used)
>blocks until it can lock the file it wants to lock. Consider the following
>short program:
>-
>#!/usr/local/bin/perl5 -w
>
>use Fcntl qw(:flock);
>
>open(FD, ">blah") or die "$$ open: $!";
>flock(FD, LOCK_EX);
>print "$$ Got lock, gonna sleep\n";
>sleep 10;
>close FD;
But the open will fail if another process is writing to it! What I was
looking for was something like:
LockOrCreateSemaphore();
ProcessFile();
ReleaseOrDestorySemaphore();
As it stands, I do something like this:
BackupFile();
AttemptOpen( "+<filename" ); Does 5 attempts, sleep()ing 0.5 secs between
each.
ProcessFile();
close();
But it's not very elegant.
------------------------------
Date: 20 May 1998 16:05:21 GMT
From: ehood@geneva.acs.uci.edu (Earl Hood)
Subject: Re: One you glob it, once you don't?
Message-Id: <6juv01$93@news.service.uci.edu>
In article <356428e8.5247968@news.mmc.org>,
Jeffrey Drumm <drummj@mail.mmc.org> wrote:
>The only solution I can think of is to check the OS name variable $^O, and
>branch accordingly. If it's not "MSWin32", assume your file names are in
>@ARGV; otherwise, expand the wild cards yourself. Unfortunately, this
>doesn't solve the portability problem between the two major Win32 Perls.
Maybe a solution is to use the bash or tcsh ports for Windows as
your command-line shell instead of the shell provided by windows.
This way you can get shell wildcard expansion as under Unix.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 20 May 1998 15:59:23 GMT
From: "Ron Sullivan" <baserad2@attmail.com>
Subject: Perl 5.0 map operator
Message-Id: <01bd83d6$64787da0$e8dda487@N440-E39.att.dom>
Hi,
My name is Subbaraman and I am relatively new to Perl. I was trying out
some examples using the map operator in Perl 5.0. I tried the following
example :
#!/usr/bin/perl
@nums = ( 60 .. 62 );
$tmp = map { z,$_ } @nums;
print "$tmp\n";
According to the Perl 5.0 man page, the block inside the curly braces is
evaluated in LIST context with $_ set internally to
each element of @nums in succession and returns a list. If my understanding
is correct, the output of the RHS in the statement would be the list
(z,60,z,61,z,62). The documentation states that if the rvalue is a comma
separated list and if the lvalue is a scalar, then the scalar would be
assigned the last value in the list and that the scalar would be assigned
the length of the list only if the rvalue is a named array and not a comma
separated list. I was hoping that the last print statement would print the
value 62. But instead the output from the last statement was 6 ( probably
the length of the list ). I am not quite clear as to what is happening in
this case. Is the list generated on the RHS stored in some named array ??.
I am not able to find any PERL documentation explaining this.
I would appreciate if you could send me an e-mail detailing as to what is
happening in this case. I request you send me an e-mail to
ksubramanian@att.com or to kailash@injersey.com at your convenience.
Thanx a million,
------------------------------
Date: Wed, 20 May 1998 16:08:15 GMT
From: "Sylvia Dean" <sylvia.dean@mci.com>
Subject: Perl Help
Message-Id: <01bd8412$69ca8640$e18722a6@csp06947.cs.mci.com>
I need to write a program to open a file
sort that file using sort -t , 2 filename.
Once I do the sort I need to write to another file.
I then need to read the second file parse info and
compare two dates using something like this:
#! /usr/local/bin/perl
use Date::Manip
$string1="05/18/1998 08:45:53";
$string2="05/18/1998 08:43:57";
#$string1="Mon May 18 11:10:55 MDT 1998";
$date1=&ParseDateString($string1);
$date2=&ParseDateString($string2);
print ("date1 is " . $date1 . "\n");
print ("date2 is " . $date2 . "\n");
$delta=&DateCalc($date1,$date2,$err);
print("diff is ". $delta . "\n");
then I need to format a report. As a beginner perl programmer I have
no clue how to get started. Can anyone help me get started?
------------------------------
Date: Wed, 20 May 1998 09:59:31 -0500
From: Don Seiler <donald@cs.wisc.edu>
To: Petr Prikryl <prikryl@dcse.fee.vutbr.cz>
Subject: Re: Running Perl on Windows
Message-Id: <3562EFD3.979C48F0@cs.wisc.edu>
You have to edit the registry to make the association. some very good documentation
can be found at http://support.microsoft.com/support/kb/articles/Q150/6/29.asp
don
------------------------------
Date: Wed, 20 May 1998 11:26:25 +0000
From: rick@internetx.net ("Rick Bauman")
Subject: running scripts on multiple machines
Message-Id: <19980520151732.AAA7977@rick.internetx.net>
I have written a command line script that does the following:
takes user input
checks for availability of username
modifies the passwd file
modifies a radius database
creates a home directory and subdirectories
all of this works fine, I would like to be able to pass the values to
other scripts, running on different machines and run them. I really
dont want to create dynamic html forms and run them that way using
CGI. Any ideas?
Rick Bauman
System Administrator/Internet Express
rick@internetx.net www.internetx.net
finger rick@internetx.net for pgp public key
http://www.lowcountry.net/
Lowcountry Free Software Archives
------------------------------
Date: Wed, 20 May 1998 10:51:52 -0500
From: Default Shell User <cmeena@hotmail.com>
Subject: SNMP and Perl
Message-Id: <3562FC17.6824DF3B@hotmail.com>
Hi all,
I am trying to write a perl script that uses snmp polling commands
snmpwalk and snmpget. But I get a bunch of garbage as output. Is there
any specific snmp library for perl.
Any help would be appreciated.
thanks
------------------------------
Date: Wed, 20 May 1998 15:31:15 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Software vendor liability [Was: Does Perl have a IDE?]
Message-Id: <MPG.fccc2c2fb928b279896d8@news.min.net>
On 20 May 1998 13:51:45 GMT,
in article <6jun5h$bkn$1@ns1.arlut.utexas.edu>,
smcdow@arlut.utexas.edu (Stuart McDow) wrote:
> kfox@pt0204.pto.ford.com (Ken Fox) writes:
> >
> > Being able to sue vendors for bad software encourages vendors to
> > produce good software
>
> Hmm. I think it would encourage vendors to get out of the software
> business altogether.
No more so than auto manufacturers getting out of the business!
And look at *their* potential liabilities.
> It also makes me wonder whether this attitude discourages companies
> from writing their own software. It you roll your own software, and it
> fails, who do you sue? Yourself?
But that is exactly the situation we have now, when commercial
software vendors disclaim all liability. And we don't even have the
benefit of having the source code.
John Porter
------------------------------
Date: 20 May 1998 16:11:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Software vendor liability [Was: Does Perl have a IDE?]
Message-Id: <6juvc8$qhq$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
jdporter@min.net (John Porter) writes:
:No more so than auto manufacturers getting out of the business!
:And look at *their* potential liabilities.
Auto makers consider themselves responsible if they sell
something broken. Software manufacturers do not. They
even make you pay to fix their mistakes. This is evil.
--tom
--
USER: the word computer professionals use when they mean "idiot"
------------------------------
Date: Wed, 20 May 1998 16:40:57 GMT
From: jdporter@min.net (John Porter)
Subject: Re: Software vendor liability [Was: Does Perl have a IDE?]
Message-Id: <MPG.fccd319713075c09896db@news.min.net>
On 20 May 1998 16:11:52 GMT,
in article <6juvc8$qhq$2@csnews.cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> jdporter@min.net (John Porter) writes:
> :No more so than auto manufacturers getting out of the business!
> :And look at *their* potential liabilities.
>
> Auto makers consider themselves responsible if they sell
> something broken. Software manufacturers do not. They
> even make you pay to fix their mistakes. This is evil.
Clearly. And yet, large companies with powerful and
presumably competent legal departments continue to give their
custom to software vendors who license their software under
these terms. One wonders how this situation came about.
It must go a long way back. My guess is Big Blue probably
had a lot to do with it. It's the sort of thing you can get
away with when you're a monopoly.
John Porter
------------------------------
Date: Wed, 20 May 1998 16:55:51 +0200
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: still testing for empty array element - still stuck
Message-Id: <6jur0k$mpo$1@news.pop-stuttgart.de>
> $group = $fields[3];
>
> next if $group eq ''; # here is the problem
>
># what I need is to skip the line if $group is empty. The debugger
says
># that $group evals to 0 ' ' but the next if does not execute.
Is
># $group not empty? Here is an example of input lines:
>#
>#
># 3 01105002 3 3 EVERYONE 3
># 3 3 3 3
>
$group is not empty - $group is equal to some blanks (and/or some
tabs).
Try the following:
next unless $group =~ /\S/; # ignore unless thers is an
Non-white-space in $group.
HTH
Ronald
------------------------------
Date: Wed, 20 May 1998 15:42:02 GMT
From: Yuri Shtil <shtil@netcom.com>
Subject: Trying to install a module ...
Message-Id: <shtilEt9IA2.II@netcom.com>
I downloaded Include-1.02a from a SPAN site and followed the installation
instructions in README:
----------------------------------------------------------------
perl Makefile.PL
Can't locate ExtUtils/Manifest.pm in @INC at Makefile.PL line 5.
BEGIN failed--compilation aborted at Makefile.PL line 5.
----------------------------------------------------------------
Any idea ? This is the first time I tried to install a module.
What am I doing wrong ?
YS
------------------------------
Date: Wed, 20 May 1998 11:33:57 -0500
From: ValHolla <mswatters@att.net>
Subject: uniq command or module for perl??
Message-Id: <6jv0i5$qhb@bgtnsc03.worldnet.att.net>
Hello,
I am fairly versed in shell scripting, and I know some about perl.
I need to know of an easy way in perl to use the shell equivalent of the
uniq command.
Please help if you know of one.
Thanks in advance.
ValHolla
------------------------------
Date: 20 May 1998 16:42:06 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: uniq command or module for perl??
Message-Id: <6jv14u$mgd@news-central.tiac.net>
In article <6jv0i5$qhb@bgtnsc03.worldnet.att.net>,
ValHolla <mswatters@att.net> wrote:
>I am fairly versed in shell scripting, and I know some about perl.
>I need to know of an easy way in perl to use the shell equivalent of the
>uniq command.
>
>Please help if you know of one.
There are some techniques discussed in the FAQ (frequently asked
questions & answers). Section 4 discusses How can I extract just the
unique elements of an array?
On a recent perl installation
perldoc perlfaq4
should get you section4, otherwise you can browse http://www.perl.com and
follow the FAQs link if you have web access.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 20 May 1998 11:03:39 -0500
From: Andrew Anderson <aandrsn1@uiuc.edu>
Subject: Using perl to graph data
Message-Id: <3562FEDB.FC6C0398@uiuc.edu>
Hello->
I was wondering if anyone could give me a little push in the right
direction on this subject. It seems as if this is not too complicated
of a task in Unix, but I am running in windows and I want to be able to
graph data and display it over the net (probably gif format) thanks
-Andy
------------------------------
Date: Wed, 20 May 1998 17:06:27 +0200
From: "Ronald G\"oggel" <r.goeggel@atos-group.de>
Subject: Re: why doesn't it work??
Message-Id: <6jurki$nb8$1@news.pop-stuttgart.de>
Chico wrote <6jteqg$dar@news.iis.com.br>...
>Look at what i am trying please!!!
>
>@ARGV = ('1.txt', '2.txt', '3.txt');
>
>foreach $linha (<>) {
> print "$linha at $ARGV[0]";
>}
>
>It does not print the name of the file ( $ARGV[0] )!
>
>ps.: I was under Win95... i didn't try YET under Unix!
>
>thanks for any help supplied!!
>
the name of the current file of <> is $ARGV.
So you have to code:
@ARGV = ('1.txt', '2.txt', '3.txt'); # or via parameter
foreach $linha (<>) {
chomp $linha;
print "$linha at $ARGV\n";
}
HTH
Ronald
------------------------------
Date: Wed, 20 May 1998 16:05:37 GMT
From: dave@datacash.com (Dave MacRae)
Subject: Win32: Calling DLL's from Perl
Message-Id: <3562fd5e.2764695@news.demon.co.uk>
I have installed perl5.004_04 on my NT machine, compiled using MS VC++.
I have been supplied with an ActiveX DLL, written in MS Visual Basic.
Is it possible to use the routines in this DLL from perl, and if so how.
I have spent the last couple of day's searching the FAQs and various sites
trying to come up with a solution to this problem. Various posts suggest
it's possible but give no details of how it's done. I've seen references to
Win32::API but I can't find this on CPAN.
If necessary, I could use the ActiveState Perl.
Any help or pointers would be appreciated.
Regards
Dave MacRae
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 2648
**************************************