[13234] in Perl-Users-Digest
Perl-Users Digest, Issue: 644 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 25 20:07:23 1999
Date: Wed, 25 Aug 1999 17:05:16 -0700 (PDT)
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, 25 Aug 1999 Volume: 9 Number: 644
Today's topics:
Re: #!/usr/bin/perl not working? <aalfonso@ica.net>
Re: characters octal number (Martin Redmond)
Re: Check if user is on? (Abigail)
Re: Compiling 5.005_03 source on Solaris 7 (Abigail)
Re: Computing n.th root of a given number (Larry Rosler)
Re: Converting strings to arrays question <laurensmith@sprynet.com>
Re: Converting strings to arrays question <ilya@speakeasy.org>
Re: Converting strings to arrays question <ilya@speakeasy.org>
Re: Converting strings to arrays question <dont_ever.spam_pvoris@earthlink.net>
Re: Converting strings to arrays question <laurensmith@sprynet.com>
Date/time problems <news@news.news>
Re: Date/time problems (Larry Rosler)
Re: Date/time problems (Martien Verbruggen)
DB_File cause my scripts to run slower? <vc13stu1@americasm01.nt.com>
Re: DB_File cause my scripts to run slower? <meowing@banet.net>
Re: DB_File cause my scripts to run slower? (Abigail)
Re: dbmopen <rwmip@glink.net.hk>
Re: desperate NEWBIE <ilya@speakeasy.org>
Re: Desperately searching for perl lint (Larry Rosler)
Re: Desperately searching for perl lint (Alan Barclay)
Excel file from Perl <l463520@lmtas.lmco.com>
Re: Excel file from Perl <makkulka@cisco.com>
Re: Excel file from Perl <samay1NOhnSPAM@hotmail.com>
Re: extract text <aqumsieh@matrox.com>
Re: HELP Please!! with a script to query newsgroups (Abigail)
Re: How to "unoverride" functions? (Abigail)
loop through a hash of arrays based on array element? <akelingos@petrosys-usa.com>
Re: loop through a hash of arrays based on array elemen <makkulka@cisco.com>
Re: loop through a hash of arrays based on array elemen <dont_ever.spam_pvoris@earthlink.net>
Re: loop through a hash of arrays based on array elemen (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Aug 1999 19:56:39 -0400
From: Alan Alfonso <aalfonso@ica.net>
Subject: Re: #!/usr/bin/perl not working?
Message-Id: <37C482B7.9B27E941@ica.net>
Don't know if you have tried this. But if the program is in your
current directory try starting the program at the shell prompt by typing
./program_name. And also make sure that you have marked the file as
executable ie. chmod +x program_name
HTH
Alan
------------------------------
Date: 25 Aug 1999 21:23:33 GMT
From: redmondm@yahoo.com (Martin Redmond)
Subject: Re: characters octal number
Message-Id: <slrn7s8nl9.h5s.redmondm@mayo.kells>
On Wed, 25 Aug 1999 15:00:45 GMT, <hamed53@my-deja.com> wrote:
>hi
>does anyone know how to get any characters octal number?
>for example:
>a = 141
$char = 'a';
$oct = sprintf "%o", ord $char;
Martin
------------------------------
Date: 25 Aug 1999 18:22:47 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Check if user is on?
Message-Id: <slrn7s8uns.lhu.abigail@alexandra.delanet.com>
Patrick Tully (pmt@top.mitre.org) wrote on MMCLXXXV September MCMXCIII in
<URL:news:37C406E4.83586F5E@top.mitre.org>:
::
:: [ Question about yet another clueless webweenie who doesn't
:: understand the stateless nature of HTTP deleted ]
::
Your question is totally Perl free.
Why don't you go ask in alt.pave.the.earth?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 25 Aug 1999 18:26:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Compiling 5.005_03 source on Solaris 7
Message-Id: <slrn7s8uvm.lhu.abigail@alexandra.delanet.com>
Dominic Coombe (dominic_coombe@lotus.com) wrote on MMCLXXXV September
MCMXCIII in <URL:news:37C43189.B2D60E6@lotus.com>:
<>
<> I have only just joined this group so I am not sure if I have missed the
<> reply to this, but has anyone else experiences problems getting a 100%
<> make test on Solaris 7 on a Sparc?
Nope. No problems.
<> Running Solaris 7 on a Ultra 5
<>
<> I am using GNU gcc version = 2.95.1
Ah. I always use the SunPRO compiler.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 25 Aug 1999 15:05:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Computing n.th root of a given number
Message-Id: <MPG.122e08808986abe9989e9d@nntp.hpl.hp.com>
In article <37C32F46.C76E83FE@mail.cor.epa.gov> on Tue, 24 Aug 1999
16:48:22 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> marcza@my-deja.com wrote:
...
> > mathematically the solution should be something like
> > roundup(ln(n)/ln(2))
> >
> > But what is the most efficient way to compute the solution ?
>
> Well, you can
> use POSIX;
> to get the ceil() function.
>
> $x = ceil( log($n)/log(2) );
>
> Before you try doing this as int(...) + 1
> consider how you'd handle the case where $n==1024 so you
> don't go up to the next integer.
>
> If you're going to be doing this a *lot*, you'll probably
> want to pre-compute the value of log(2) so you don't
> compute it a few million times in your program.
Actually, that makes only a small difference -- in the wrong direction!
This might be a good time to dispose of the other responders who favored
shift-loops over logs. They seem not to be aware that executing Perl
instructions takes lots of time compared to calling built-in functions.
I am waiting for Steffen Beyer to tell us about the function in
Bit::Vector that provides the desired information directly.
Benchmark: timing 65536 iterations of Cntrl, Log00, Log01, Log10, Log11,
Shift0, Shift1...
Cntrl: 1 wallclock secs ( 0.56 usr + 0.00 sys = 0.56 CPU)
Log00: 2 wallclock secs ( 1.58 usr + 0.00 sys = 1.58 CPU)
Log01: 1 wallclock secs ( 1.33 usr + 0.00 sys = 1.33 CPU)
Log10: 0 wallclock secs ( 1.52 usr + 0.00 sys = 1.52 CPU)
Log11: 2 wallclock secs ( 1.31 usr + 0.00 sys = 1.31 CPU)
Shift0: 2 wallclock secs ( 1.77 usr + 0.00 sys = 1.77 CPU)
Shift1: 5 wallclock secs ( 4.84 usr + 0.00 sys = 4.84 CPU)
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
sub Cntrl { shift }
my $log2 = log 2;
sub Log0 {
my $j = log(shift)/$log2;
int $j == $j ? $j : int $j + 1;
}
sub Log1 {
my $j = log(shift)/log(2);
int $j == $j ? $j : int $j + 1;
}
sub Shift {
my $n = shift() - 1;
my $x = 1;
++$x while $n >>= 1;
$x;
}
timethese(1 << (shift || 0), {
Cntrl => sub { Cntrl(11) },
Log00 => sub { Log0(11) },
Log01 => sub { Log0(1 << 30) },
Log10 => sub { Log1(11) },
Log11 => sub { Log1(1 << 30) },
Shift0 => sub { Shift(11) },
Shift1 => sub { Shift(1 << 30) },
});
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 25 Aug 1999 14:53:36 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: Converting strings to arrays question
Message-Id: <7q1ol1$82o$1@brokaw.wa.com>
Ilya wrote in message ...
>If I have a loop like this:
>
> foreach $value (values (%input_params))
> {
> push (@data, @value);
> }
>
>I want to turn $value into @value, for instance instead of dealing with
$cpu,
>I want to deal with @cpu. @($spu) does not work of course. Any
suggestions?
Huh?
Do you mean put all values of a hash into an array?
@values = values(%input_params);
Or do you mean you want to stick some value into the end of an array?
push (@values, $value);
Lauren
------------------------------
Date: Wed, 25 Aug 1999 22:49:46 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Converting strings to arrays question
Message-Id: <rs8soar0h9720@corp.supernews.com>
David Cassell <cassell@mail.cor.epa.gov> wrote:
> Ilya wrote:
>>
>> If I have a loop like this:
>>
>> foreach $value (values (%input_params))
>> {
>> push (@data, @value);
>> }
>>
>> I want to turn $value into @value, for instance instead of dealing with $cpu,
>> I want to deal with @cpu. @($spu) does not work of course. Any suggestions?
> My first suggestion is that you explain a little more what
> you're trying to do.
> You are aware, of course, that $cpu and @cpu are entirely
> different beasts, and one may have no relation whatsoever
> to the other. $cpu is a scalar and @cpu is an array.
I *do* realize that $cpu and @cpu are different items and that is where the
difficulty comes from. I can explain what I am doing. The perl/CGI script
sets the parameters that the user wants to look at. I run a bunch of scripts
to take sar data collected over the last few months and each array,
i.e. @cpu_usr holds numbers that represent one line on the graph. Since they
user may not want to look at all the variables, he chooses the ones he wants.
Depending on the ones the user wants, I set $cpu_usr (and many others) to a
value. If the value of $cpu_usr is zero, then I know that the user does not
want to look at @cpu_usr array based on sar.
So:
foreach $value (values (%input_params))
{
if ($value ne 0) # we have an array that the user wants to examine
{
push (@data, @value)
}
}
Then @data is used to dynamicaly build a GIF graph.
This is the pseudo code. I need to turn it into real Perl code. It is a
trivial problem, but I cannot figure it out.
> So:
> [1] why don't you want to say:
> push @data, $value;
> or perhaps save the values in a more recognizable structure?
> [2] why are you trying to use values() like this? This will
> probably not be what you want, and if you have hash pairs
> where the values end up the same, you'll lose things. Look
> into keys() and each() instead.
==============================================================================
Though we have many valleys to travel and mountains to climb, by nature we are
inclined to fear the unknown. Life rewards those of us who accept the call to
go where we have never been even when we, seemingly, have to go there alone.
==============================================================================
------------------------------
Date: Wed, 25 Aug 1999 22:56:51 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Converting strings to arrays question
Message-Id: <rs8t5jmjh9777@corp.supernews.com>
Lauren Smith <laurensmith@sprynet.com> wrote:
> Ilya wrote in message ...
>>If I have a loop like this:
>>
>> foreach $value (values (%input_params))
>> {
>> push (@data, @value);
>> }
>>
>>I want to turn $value into @value, for instance instead of dealing with
> $cpu,
>>I want to deal with @cpu. @($spu) does not work of course. Any
> suggestions?
> Huh?
> Do you mean put all values of a hash into an array?
> @values = values(%input_params);
Nope.... I don't want to take the values of %input_params. They merely
represent something. i.e. if $input_params{$key} eq 1 I want to take @value,
not $value and do something with it.
> Or do you mean you want to stick some value into the end of an array?
> push (@values, $value);
$value is 1 or 0.
Whenever I see $value, I want to turn it into @value.
------------------------------
Date: Wed, 25 Aug 1999 15:49:48 -0700
From: Joe Schmoe <dont_ever.spam_pvoris@earthlink.net>
Subject: Re: Converting strings to arrays question
Message-Id: <37C4730C.ADA1D95@earthlink.net>
It's a bit difficult to understand what you want. Please clarify.
------------------------------
Date: Wed, 25 Aug 1999 16:40:29 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: Converting strings to arrays question
Message-Id: <7q1ute$ikl$1@brokaw.wa.com>
Ilya wrote in message ...
>The perl/CGI script
>sets the parameters that the user wants to look at. I run a bunch of
scripts
>to take sar data collected over the last few months and each array,
>i.e. @cpu_usr holds numbers that represent one line on the graph. Since
they
>user may not want to look at all the variables, he chooses the ones he
wants.
>Depending on the ones the user wants, I set $cpu_usr (and many others)
to a
>value. If the value of $cpu_usr is zero, then I know that the user does
not
>want to look at @cpu_usr array based on sar.
>
It sounds like you're looking for a way to get an array of values by
selecting its key in a hash.
Go check out perldsc: HASHES OF LISTS
The LISTS OF LISTS section may be worth looking into also.
Lauren
------------------------------
Date: Wed, 25 Aug 1999 23:26:52 +0100
From: news <news@news.news>
Subject: Date/time problems
Message-Id: <37C46DAC.A4777EDA@news.news>
Dear all,
# This prints seconds from epoch ok
$date = time;
# This returns nothing
$date = localtime;
This too
$date =gmtime;
Any ideas? I can't use the date command becuase it is not available.
Thanks in advance.
Saiid.
saiid@excite.com
------------------------------
Date: Wed, 25 Aug 1999 16:04:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Date/time problems
Message-Id: <MPG.122e1654889b62c989ea0@nntp.hpl.hp.com>
In article <37C46DAC.A4777EDA@news.news> on Wed, 25 Aug 1999 23:26:52
+0100, news <news@news.news> says...
> Dear all,
>
> # This prints seconds from epoch ok
> $date = time;
>
> # This returns nothing
> $date = localtime;
>
> This too
> $date =gmtime;
>
> Any ideas? I can't use the date command becuase it is not available.
Your perl is not functioning properly. Try rebuilding or reinstalling
it.
#!/usr/local/bin/perl -w
use strict;
my $date;
# This prints seconds from epoch ok
$date = time;
print "$date\n";
# This returns nothing
$date = localtime;
print "$date\n";
# This too
$date =gmtime;
print "$date\n";
__END__
Output:
935622178
Wed Aug 25 16:02:58 1999
Wed Aug 25 23:02:58 1999
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 26 Aug 1999 00:04:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Date/time problems
Message-Id: <Lw%w3.3090$hf4.39254@nsw.nnrp.telstra.net>
In article <37C46DAC.A4777EDA@news.news>,
news <news@news.news> writes:
> Dear all,
>
> # This prints seconds from epoch ok
> $date = time;
>
> # This returns nothing
> $date = localtime;
>
> This too
> $date =gmtime;
>
> Any ideas? I can't use the date command becuase it is not available.
Is this maybe perl 4?
If so, you probably should get yourself a perl5 installation.
Martien
--
Martien Verbruggen |
Interactive Media Division | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: Wed, 25 Aug 1999 18:55:15 -0400
From: "Chaudhry, Asad" <vc13stu1@americasm01.nt.com>
Subject: DB_File cause my scripts to run slower?
Message-Id: <37C47453.B1766249@americasm01.nt.com>
Hi,
I'm using DB_File to tie large arrays and hashes. I find that my scripts
run slower when I tie my data with DB_File as opposed to using ordinary
arrays and hashes within perl. The reason I need to use DB_File is that
sometimes I'm parsing in large files containing many records, which
causes perl to run 'Out of memory!'. I can overcome this problem by
using DB_File but the speed of the scripts is cut in half.
My question is: Is there away to increase performance, or is this a
trade-off for using DB_File?
Thanks
Asad.
------------------------------
Date: 25 Aug 1999 19:28:54 -0400
From: meow <meowing@banet.net>
Subject: Re: DB_File cause my scripts to run slower?
Message-Id: <871zcr30eh.fsf@slip-32-101-160-55.ma.us.ibm.net>
Chaudhry, Asad <vc13stu1@americasm01.nt.com> wrote:
> I'm using DB_File to tie large arrays and hashes. I find that my scripts
> run slower when I tie my data with DB_File as opposed to using ordinary
> arrays and hashes within perl.
That's normal. You are now storing data on disk instead of core, and
that is nearly always going to be a much slower process. The
buffering only helps so much, and not too much at all if you need to
touch all of a large file.
> The reason I need to use DB_File is that sometimes I'm parsing in
> large files containing many records, which causes perl to run 'Out
> of memory!'. I can overcome this problem by using DB_File but the
> speed of the scripts is cut in half.
> My question is: Is there away to increase performance, or is this a
> trade-off for using DB_File?
Maybe a direct mapping isn't what you want. See if you can re-think
the problem in a way that doesn't require one big hash (i.e., split
the work into smaller chunks that will fit into core), or maybe use a
different data structure altogether. You don't say what it is you're
trying to do with these files, so you get equally fuzzy answers...
Don't overlook the idea of throwing more hardware at the problem,
either. If you need more memory to solve the problem, add it. Quite
often these days, it's going to be cheaper than the time you would
spend tweaking your program to fit a smaller machine.
------------------------------
Date: 25 Aug 1999 18:30:25 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: DB_File cause my scripts to run slower?
Message-Id: <slrn7s8v66.lhu.abigail@alexandra.delanet.com>
Asad (vc13stu1@americasm01.nt.com) wrote on MMCLXXXV September MCMXCIII
in <URL:news:37C47453.B1766249@americasm01.nt.com>:
~~
~~ My question is: Is there away to increase performance, or is this a
~~ trade-off for using DB_File?
That's a trade off.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 26 Aug 1999 07:47:22 +0800
From: Raymond Ip <rwmip@glink.net.hk>
To: rlw_ctx@my-deja.com
Subject: Re: dbmopen
Message-Id: <37C4808A.44026BBE@glink.net.hk>
Thanks, but I know dbmopen can read some format file.. would I set
something to let dbmopen to read xx.db first instead of xx.pag, xx.dir
..
Best Regards
Raymond Ip
rlw_ctx@my-deja.com ¼g¤J¡G
> In article <7q0kd7$9pd$1@unix2.glink.net.hk>,
> rwmip@glink.net.hk (Raymond Ip) wrote:
> > Can I tell perl to use dbmopen to open xx.db instead of
> > xx.page, xx.dir
> > I'm running on SunSparc 7
>
> Try the DB_FIle module instead.
>
> --
> Ron Wilson
> Connectex, LLC
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Wed, 25 Aug 1999 23:23:14 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: desperate NEWBIE
Message-Id: <rs8un2ssh9765@corp.supernews.com>
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> GiN <wablief@freemail.nl> wrote:
>> the following sub should return 1 when port is open and 0 when port is
>> closed or if something times out ( port filtered).
>> but it won't work!!!
>> who can help me out??
>>
> You have already posted this question.
If he asking again, don't you think it is fairly obvious he is not satisfied
with the first response, if any?
==============================================================================
Though we have many valleys to travel and mountains to climb, by nature we are
inclined to fear the unknown. Life rewards those of us who accept the call to
go where we have never been even when we, seemingly, have to go there alone.
==============================================================================
------------------------------
Date: Wed, 25 Aug 1999 15:40:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Desperately searching for perl lint
Message-Id: <MPG.122e10aeaed89ffe989e9f@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7q1mmt$rl$1@gellyfish.btinternet.com> on 25 Aug 1999
21:20:29 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
...
> I think then perhaps you should explain what this fabled linter is
> supposed to do in addition to those flags? The C 'lint' only came as
> a separate program because in the early days of C having those checks
> in the compiler would have made it to large for the systems on which it
> was supposed to run. Nowadays most compilers include such a capability -
> gcc for instance has a 'pedantic' switch. If I can stretch the analogy
> a little then the kind of things that '-w' and 'use strict' complain
> about are fairly equivalent to what a traditional C lint would.
'-w' complains at run time, which might sink the Titanic after launch,
in mid-Atlantic. What he wants is checking at compile time. As I said
in another branch of this thread, this *can* be done (in the absence of
'eval STRING'.
sub foo {
my $bar;
return $bar;
}
...
Perl lint:
Variable '$bar' used before it has been given a value.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 25 Aug 1999 23:32:31 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: Desperately searching for perl lint
Message-Id: <935624194.672914@elaine.drink.com>
In article <MPG.122e10aeaed89ffe989e9f@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>'-w' complains at run time, which might sink the Titanic after launch,
>in mid-Atlantic. What he wants is checking at compile time. As I said
>in another branch of this thread, this *can* be done (in the absence of
>'eval STRING'.
Doesn't -w complain at both run time and compile time, depending on
the warning?
This script:
#!/usr/local/bin/perl -w
sleep 90;
if(1==2){
if($a=2){
error;
};
}
Produces it's warnings as soon as it's called, before the 90 second sleep
is complete, despite the "$a=2" and "error;" being in code which is
never run.
On the other hand, this program
#!/usr/local/bin/perl -w
if(rand>.5){
$something=1;
}
print $something;
can only produce a run time warning, as the compiler doesn't know the
value of something.
------------------------------
Date: Wed, 25 Aug 1999 17:33:00 -0500
From: Michael Hill <l463520@lmtas.lmco.com>
Subject: Excel file from Perl
Message-Id: <37C46F1C.FA97A96F@lmtas.lmco.com>
I have some perl scripts that create HTML tables from and Oracle DB.
However some users want me to send then and excel file. Anyone have any
exemples of this?
Mike
------------------------------
Date: Wed, 25 Aug 1999 15:54:34 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Excel file from Perl
Message-Id: <37C4742A.DE2A0AE3@cisco.com>
[ Michael Hill wrote:
> I have some perl scripts that create HTML tables from and Oracle DB.
> However some users want me to send then and excel file. Anyone have any
> exemples of this?
Excel will accept a file where your cell data is separated with tabs ( or
commas).
If you try opening such a text file Excel will automatically open this file
and import the contents.
------------------------------
Date: Wed, 25 Aug 1999 16:18:26 -0700
From: Samay <samay1NOhnSPAM@hotmail.com>
Subject: Re: Excel file from Perl
Message-Id: <17599f0b.f113840a@usw-ex0106-048.remarq.com>
You can also use Win32::OLE
Let me know if further help is required..
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 25 Aug 1999 17:33:05 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: extract text
Message-Id: <x3ypv0bwnou.fsf@tigre.matrox.com>
"michael hagberg" <mzh@cntw.com> writes:
> yes, I know, thats what I've done. I just dont find the code that fancy and
> hoped there was some nice looking shortcut to get the work done. Guess
> theres not...yet. Thanks for the help anyway!
This is Perl. TMTOWTDI.
Checkout perlre. Use regexps.
--Ala
------------------------------
Date: 25 Aug 1999 17:54:44 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: HELP Please!! with a script to query newsgroups
Message-Id: <slrn7s8t39.lhu.abigail@alexandra.delanet.com>
niki (niki@nirvanet.net) wrote on MMCLXXXV September MCMXCIII in
<URL:news:37C45674.C13D04ED@nirvanet.net>:
[]
[] I am in dire need for a perl script which can query a NNTP server and
[] count the number of headers for different newsgroups. The number of
[] headers should then be stored in a text file (or html file).
That's the third time you post this gimme-gimme-gimme article.
*plonk*
Abigail
--
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} # Yet Another silly JAPH by Abigail
sub A::FETCH {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 25 Aug 1999 17:48:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to "unoverride" functions?
Message-Id: <slrn7s8snl.lhu.abigail@alexandra.delanet.com>
pgmr (a@b.com) wrote on MMCLXXXV September MCMXCIII in
<URL:news:80CD4CA65DC698D8.7B259DCA8C4A214B.1B18548C439871D4@lp.airnews.net>:
;; Yes, thank you for that. The syntax is not the problem as these were
;; not actual code. I just typed them in as examples to show the problem
;; at hand. The actual code is much too long to be useful in a usenet
;; post. Assuming the syntax is correct (making your changes), the
;; program still does not work because of the fundamental problem of
;; overridden functions where the function overriding returns a different
;; data type (object) than the original function (list or scalar).
I would have pointed out the error in your statement if you hadn't
insisted on posting jeopardy style, as I did tell you what you need
to do. However, Jeopardist won't get an answer for me - they seek
questions.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 25 Aug 1999 22:29:15 GMT
From: "Alec Kelingos" <akelingos@petrosys-usa.com>
Subject: loop through a hash of arrays based on array element?
Message-Id: <01beef49$e7bfa460$0664a8c0@psusa6.petrosys-usa.com>
How can I sort a hash of arrays based on one of the array elements? For
example, I have a hash
%columns = (
'API' => ['A', 1, 14, 'STR', 1],
'LATITUDE' => ['A', 2, 9, 'LAT', 2],
'LONGITUDE' => ['A', 3, 20, 'LON', 3],
'TD_FORM' => ['A', 4, 8, 'STR', 4],
'PR_FORM' => ['A', 5, 8, 'STR', 5],
'STATUS' => ['A', 8, 6, 'STR', 6]
)
The following:
Foreach $col ( keys %columns ) { print "$col\n"; }
Goes through the keys in an unpredictable order. How can I loop through
the hash keys based on the last element in the array references (the last
one in this example)?
OR is there some way of looping through the keys in the original order that
they were entered?
------------------------------
Date: Wed, 25 Aug 1999 15:51:12 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: loop through a hash of arrays based on array element?
Message-Id: <37C47360.4941C2F2@cisco.com>
[ Alec Kelingos wrote:
> How can I sort a hash of arrays based on one of the array elements? For
> example, I have a hash
> %columns = (
> 'API' => ['A', 1, 14, 'STR', 1],
> 'LATITUDE' => ['A', 2, 9, 'LAT', 2],
> 'LONGITUDE' => ['A', 3, 20, 'LON', 3],
> 'TD_FORM' => ['A', 4, 8, 'STR', 4],
> 'PR_FORM' => ['A', 5, 8, 'STR', 5],
> 'STATUS' => ['A', 8, 6, 'STR', 6]
> );
See the code sample below
%columns = (
'API' => ['A', 1, 14, 'STR', 1],
'LATITUDE' => ['A', 2, 9, 'LAT', 2],
'LONGITUDE' => ['A', 3, 20, 'LON', 3],
'TD_FORM' => ['A', 4, 8, 'STR', 4],
'PR_FORM' => ['A', 5, 8, 'STR', 5],
'STATUS' => ['A', 8, 6, 'STR', 6]
);
$columns = \%columns ;
my @sorted ;
@sorted = sort { $columns->{$a}->[0] cmp $columns->{$b}->[0] } keys %columns ;
print " keys sorted based on 0th col element of the array ref.." . join (' ',
@sorted ) . "\n" ;
@sorted = sort { $columns->{$a}->[1] <=> $columns->{$b}->[1] } keys %columns ;
print " keys sorted based on 1st col element of the array ref.." . join (' ',
@sorted ) . "\n" ;
@sorted = sort { $columns->{$a}->[2] <=> $columns->{$b}->[2] } keys %columns ;
print " keys sorted based on 2nd col element of the array ref.." . join (' ',
@sorted ) . "\n" ;
@sorted = sort { $columns->{$a}->[3] cmp $columns->{$b}->[3] } keys %columns ;
print " keys sorted based on 3rd col element of the array ref.." . join (' ',
@sorted ) . "\n" ;
@sorted = sort { $columns->{$a}->[4] cmp $columns->{$b}->[4] } keys %columns ;
print " keys sorted based on 4th col element of the array ref.." . join (' ',
@sorted ) . "\n" ;
exit ;
--Results --
keys sorted based on 0th col element of the array ref..API TD_FORM LONGITUDE
STATUS LATITUDE PR_FORM
keys sorted based on 1st col element of the array ref..API LATITUDE LONGITUDE
TD_FORM PR_FORM STATUS
keys sorted based on 2nd col element of the array ref..STATUS TD_FORM PR_FORM
LATITUDE API LONGITUDE
keys sorted based on 3rd col element of the array ref..LATITUDE LONGITUDE API
TD_FORM STATUS PR_FORM
keys sorted based on 4th col element of the array ref..API LATITUDE LONGITUDE
TD_FORM PR_FORM STATUS
------------------------------
Date: Wed, 25 Aug 1999 15:43:27 -0700
From: Joe Schmoe <dont_ever.spam_pvoris@earthlink.net>
Subject: Re: loop through a hash of arrays based on array element?
Message-Id: <37C4718F.C72E04C7@earthlink.net>
Assuming I understand you correctly (meaning that you want to sort the
keys by element [4] of the arrays whose references the keys are
associated with), try this:
#!/usr/bin/perl -w
use strict;
my %columns = (
'API' => ['A', 1, 14, 'STR', 1],
'LATITUDE' => ['A', 2, 9, 'LAT', 2],
'LONGITUDE' => ['A', 3, 20, 'LON', 3],
'TD_FORM' => ['A', 4, 8, 'STR', 4],
'PR_FORM' => ['A', 5, 8, 'STR', 5],
'STATUS' => ['A', 8, 6, 'STR', 6]
);
foreach ( sort { $columns{$a}[4] cmp $columns{$b}[4] } keys %columns ) {
print "$_\n";
}
------------------------------
Date: 25 Aug 1999 18:39:25 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: loop through a hash of arrays based on array element?
Message-Id: <slrn7s8vn2.lhu.abigail@alexandra.delanet.com>
Alec Kelingos (akelingos@petrosys-usa.com) wrote on MMCLXXXV September
MCMXCIII in <URL:news:01beef49$e7bfa460$0664a8c0@psusa6.petrosys-usa.com>:
.. How can I sort a hash of arrays based on one of the array elements? For
.. example, I have a hash
FAQ.
Abigail
--
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 644
*************************************