[10453] in Perl-Users-Digest
Perl-Users Digest, Issue: 4045 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 22 12:04:19 1998
Date: Thu, 22 Oct 98 09:00:23 -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 Thu, 22 Oct 1998 Volume: 8 Number: 4045
Today's topics:
Re: %SIG handlers for CGI <rootbeer@teleport.com>
Re: -Help Please-: Efficiency of substr vs. join for st <jdporter@min.net>
Re: about ssi and <img src... <rootbeer@teleport.com>
applying perlipc ? <prl2@lehigh.edu>
Re: Count files in a dir SSI or CGI <rootbeer@teleport.com>
Re: flock() win32 <eunpingc@ucsd.edu>
Re: help shorten one-liner jkane@my-dejanews.com
Re: help shorten one-liner jkane@my-dejanews.com
how do you add three variables <marx@idiom.com>
Re: how do you add three variables <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: I digress... <ckc@dmi.dk>
Re: interacting with alarm <rootbeer@teleport.com>
Re: interacting with alarm <aqumsieh@matrox.com>
Re: MD5 module installation problems <rootbeer@teleport.com>
Re: Need help with perl pgm (Andrew M. Langmead)
Re: Need help with perl pgm (Larry Rosler)
Re: Perl & Y2K - booby trap code <murrayb@vansel.alcatel.com>
Re: Perl & Y2K - booby trap code (Bart Lateur)
Re: Perl Cookbook - is this the best perl book? <eashton@bbnplanet.com>
Re: Perl Y2K copmliance <rootbeer@teleport.com>
Re: plain text to HTML (Joergen W. Lang)
Re: Q:Array of Lists <avitala@macs.biu.ac.il>
Re: Q:Array of Lists (Joergen W. Lang)
Re: Reference to a sort function (Andrew M. Langmead)
Re: sequential line count <rootbeer@teleport.com>
Re: sort <rootbeer@teleport.com>
Re: trouble reading binary files <rootbeer@teleport.com>
Updating Record Structures? <vickie.cooper@boeing.com>
Re: What's the "best" way to call one Perl script from <aqumsieh@matrox.com>
Re: where download nmake.exe ? dturley@pobox.com
Re: Windows NT and Perl - File Structure - opendir & re (David Cantrell)
Re: Windows NT and Perl - File Structure - opendir & re (momus)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 22 Oct 1998 15:36:06 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: %SIG handlers for CGI
Message-Id: <Pine.GSO.4.02A.9810220833230.5534-100000@user2.teleport.com>
On Thu, 22 Oct 1998, Bart Lateur wrote:
> If I set $SIG{ALRM} and do an alarm(120), would this keep my script
> alive, if it otherwise would have been aborted?
Setting $SIG{ALRM} might help, if your process is being aborted by an
alarm signal. But merely scheduling an alarm won't do anything to keep
your process alive.
See the sigtrap module, and check your server's docs to find out what
signals it sends. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 11:11:01 -0400
From: John Porter <jdporter@min.net>
Subject: Re: -Help Please-: Efficiency of substr vs. join for string manipulation ?
Message-Id: <362F4B05.51A20ED5@min.net>
David Alan Black wrote:
>
> So here's my best shot:
>
> sub stringmanipulator {
> my ($orig, $interp) = @_;
> my $i = index($orig,"KEYWORD") or die "Didnt find KEYWORD";
> "EXTRA STUFF$interp" . substr($orig, $i + 7);
> }
You can get another little speed-up by replacing that one
interpolation with a dot op:
sub stringmanipulator {
my ($orig, $interp) = @_;
my $i = index($orig,"KEYWORD") or die "Didnt find KEYWORD";
"EXTRA STUFF" . $interp . substr($orig, $i + 7);
}
--
John "Throbblefoot" Porter
"The people at the Grey Hotel
Are either aged or unwell." -- EG
------------------------------
Date: Thu, 22 Oct 1998 15:42:08 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: about ssi and <img src...
Message-Id: <Pine.GSO.4.02A.9810220839470.5534-100000@user2.teleport.com>
On Thu, 22 Oct 1998, DuhK wrote:
> My question is this.. Is there anyway to return content=text/html
> using the <img src.. tag?
There may or may not be; the answer may be found via the docs, FAQs, and
newsgroups about web-related programming. Of course, the answer is the
same whether you're programming in Perl or not, so there's not much I can
tell you in an on-topic message in a Perl newsgroup. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 10:20:52 -0400
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: applying perlipc ?
Message-Id: <70nf13$1afc@fidoii.cc.Lehigh.EDU>
Hello, please find a small excerpt from perlipc at the end of this message. I
have a question based on the excerpt.
My question:
In the first excerpt, I am told all I can do is "set a global variable and then
raise an exception." But in the next excerpt I am told I can put off the
processing of the signal using 'IGNORE'. What is 'IGNORE'? Just a string, or
something special to Perl?
Whatever IGNORE is, I am drawing the following lesson: (Please correct me, as
I really don't understand all that re-entrant stuff...)
### BAD! ###
local $SIG{"INT"} = sub {
ReadMode(0); # restore original console settings
exit(0);
};
### GOOD! ###
sub IGNORE_INT {
local $SIG{INT} = 'IGNORE';
&clean_and_die;
}
sub clean_and_die {
ReadMode(0);
exit(0);
}
local $SIG{"INT"} = \&IGNORE_INT;
# The real stuff I'm trying to do...
Have I applied the perlipc info correctly?
Thanks for any help!
Phil R Lawrence
EXCERPTS FROM PERLIPC:
<snip!>
Do as little as you possibly can in your handler; notice how all we do is set a
global variable and then raise an exception. That's because on most systems,
libraries are not re-entrant; particularly, memory allocation and I/O routines
are not. That means that doing nearly anything in your handler could in theory
trigger a memory fault and subsequent core dump.
sub catch_zap {
my $signame = shift;
$shucks++;
die "Somebody sent me a SIG$signame";
}
$SIG{INT} = 'catch_zap'; # could fail in modules
$SIG{INT} = \&catch_zap; # best strategy
<snip!>
You may also choose to assign the strings 'IGNORE' or 'DEFAULT' as the handler,
in which case Perl will try to discard the signal or do the default thing. Some
signals can be neither trapped nor ignored, such as the KILL and STOP (but not
the TSTP) signals. One strategy for temporarily ignoring signals is to use a
local() statement, which will be automatically restored once your block is
exited. (Remember that local() values are ``inherited'' by functions called
from within that block.)
sub precious {
local $SIG{INT} = 'IGNORE';
&more_functions;
}
sub more_functions {
# interrupts still ignored, for now...
}
------------------------------
Date: Thu, 22 Oct 1998 15:32:18 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Count files in a dir SSI or CGI
Message-Id: <Pine.GSO.4.02A.9810220831010.5534-100000@user2.teleport.com>
On Thu, 22 Oct 1998, DuhK wrote:
> $cnt = "1";
> foreach $file (@files) {
> $cnt++;
> }
Of course, that loop is a waste.
$cnt = 1 + @files; # But is that really what you want?
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 08:11:21 -0700
From: E Unpingco <eunpingc@ucsd.edu>
Subject: Re: flock() win32
Message-Id: <362F4B19.29024B28@ucsd.edu>
Is there a way I can get flock support for win98?
Also, I've read of fcntl(). Has anyone used this successfully under
windows95/98 because I keep getting a function undefined error.
------------------------------
Date: Thu, 22 Oct 1998 15:04:13 GMT
From: jkane@my-dejanews.com
Subject: Re: help shorten one-liner
Message-Id: <70nhhd$vkd$1@nnrp1.dejanews.com>
In article <saru30zlyfz.fsf@camel.fastserv.com>,
Uri Guttman <uri@camel.fastserv.com> wrote:
> j> I am using 4.0.1.8, is this an old version that doesn't support
> j> that?
>
> oy gevalt!! that is as old as ronald reagan! and about as useful!
>
> get the latest perl and drop that 4.x fast.
>
> END is a perl5 feature.
>
> uri
OK, I bet that is also why the other suggestion using also gets an error
message. (Even after adding the correct semicolons.) Now I need 6 days of
work to get enough paper together to show why it is important to upgrade! :{
) Of course no body else ever had that problem.
Any gotchas on existing perl4 programs running under perl5? Probably a faq
question. I will go hunting for it. I know that is going to be the first
concern. Don't want to break what already works.
Thanks for everyones help.
-Jeff
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Oct 1998 15:09:36 GMT
From: jkane@my-dejanews.com
Subject: Re: help shorten one-liner
Message-Id: <70nhrg$vsc$1@nnrp1.dejanews.com>
In article <1dh7nnf.198xbgw1o0ko2bN@host014-210.seicom.net>,
jwl@_munged_worldmusic.de (Joergen W. Lang) wrote:
> <jkane@my-dejanews.com> wrote:
>
> > FYI: The pattern is looking for a semicolon, right curly brace, or left
curly
> > brace followed by anything, a #, a space, and finally anything more. I
figure
> > that there will never be comments in the middle of a line that does not have
> > one of these chars delimiting the end of it. Am I wrong?
>
> Yes.
> For example in extended regexes like this one:
>
> $string =~ s/ (
> (^\w) #at the beginning of the line
> | # or
> (\s\w) #preceded by whitespace
> )
> /\U$1/xg;
> $string =~ /([\w']+)/\u\L$1/g;
>
> There can also be more than one space and/or tabs. Comments can also be
> in the beginning of a line. And sometimes people even do multi-line
> comments, as described in perlfaq7
>
> How can I comment out a large block of perl code?
> Use embedded POD to discard it: (..etc..)
>
> #!/usr/bin/perl -w
>
> print "Something ";
>
> =for nobody
>
> Here is some POD style commenting, which
> can throw your whole concept of commenting way over...
>
> =cut
>
> print "under the bed is drooling.";
> __END__
>
> Hmmm....
>
> Joergen
I didn't realize you could comment in the middle of a statement. I have had a
couple of these suggestions from others also. I like the idea of breaking the
comments up like this rather than one long one just before or after.
I will have to relook at my regex and think about it further. But, that is
what learning is all about. This was a worth while exercise! I not only
learned a little about the line I was trying to make, but also about how perl
can be even more different. (Except this time it has an advantage as long as
people use the comments in the middle concept.)
Thanks
-Jeff
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Oct 1998 10:12:27 -0500
From: "Marcus J. Foody" <marx@idiom.com>
Subject: how do you add three variables
Message-Id: <362F4B5B.5BE5@idiom.com>
Hello, I know this is a lame question. How do you add three variables
together.
For example, I want to sum up three fields into on variable.
This is what I have. Is this a correct format?
$sum = $data[14]+$data[15]+$data[16];
------------------------------
Date: 22 Oct 1998 17:26:35 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: how do you add three variables
Message-Id: <83btn4obx0.fsf@vcpc.univie.ac.at>
Re: how do you add three variables, Marcus <marx@idiom.com>
said:
Marcus> Hello, I know this is a lame question. How do you
Marcus> add three variables together.
Marcus> For example, I want to sum up three fields into on
Marcus> variable. This is what I have. Is this a correct
Marcus> format?
Marcus> $sum = $data[14]+$data[15]+$data[16];
It would be easier to actually try this out yourself, than
post it to the net... :-)
How about (code vaguely tested):
sub sum_elements {
my $aref = shift;
my $v = 0;
foreach my $e (@_) {
$v += @$aref[$e];
}
$v;
}
my @data = ( 0 .. 63 );
my $s = sum_elements(\@data, 14, 15, 16);
print "$s\n";
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Thu, 22 Oct 1998 16:26:50 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: I digress...
Message-Id: <Pine.GSO.3.92.981022162423.29618H-100000@edb>
On 22 Oct 1998, Michael J Gebis wrote:
[Making sure a number has a leading zero if it's below 10]
> # The regexp way
> "0$intMonth" =~ m/(\d\d)$/;
> $intMonth = $1;
[SNIP other ways.]
TIYAWTDI:
# The s/// way
$intMonth =~ s/^(\d)$/0$1/;
Kvan.
-------Casper Kvan Clausen------ | 'I haven't seen an Englishman take a
----------<ckc@dmi.dk>---------- | blow like that since Hugh Grant!
Lokal 544 |
I do not speak for DMI, just me. | - Football announcer.
------------------------------
Date: Thu, 22 Oct 1998 15:16:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: interacting with alarm
Message-Id: <Pine.GSO.4.02A.9810220815530.5534-100000@user2.teleport.com>
On Wed, 21 Oct 1998, Mark Sholund wrote:
> I am trying to write a routine that waits x seconds for a keystroke
> and if it doesn't, it executes some code.
The FAQ talks about this. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 22 Oct 1998 10:14:38 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: interacting with alarm
Message-Id: <x3yiuhcisz5.fsf@tigre.matrox.com>
Mark Sholund <msholund@wans.net> writes:
>
> while (1)
> {
> $SIG(ALRM) = 'my_timer';
This should be $SIG{ALRM} = \&my_timer;
--
Ala Qumsieh email: aqumsieh@matrox.com
ASIC Design Engineer phone: (514) 822-6000 x7581
Matrox Graphics Inc. (old) webpage :
Montreal, Quebec http://www.cim.mcgill.ca/~qumsieh
------------------------------
Date: Thu, 22 Oct 1998 15:12:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: MD5 module installation problems
Message-Id: <Pine.GSO.4.02A.9810220811420.5534-100000@user2.teleport.com>
On Thu, 22 Oct 1998 hermeet11@my-dejanews.com wrote:
> In file included from MD5.xs:20:
> /usr/local/lib/perl5/sun4-solaris/5.00404/CORE/perl.h:163: sys/types.h:
> No such file or directory
Sounds as if you don't have that file. My guess is that someone deleted
your Perl source. Re-install Perl. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 15:32:00 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Need help with perl pgm
Message-Id: <F18J5C.LMH@world.std.com>
tadmc@flash.net (Tad McClellan) writes:
>: while ($line = <InFile>)
> ^^^^^^^^^^^^^^^^
> That is not '-w clean'.
Depends on which version of perl. It didn't emit a warning up through
version 5.003, and doesn't give a warning with the current version
5.005. In some ways the emitting of a warning in 5.004 could be
considered a bug in the interpreter.
--
Andrew Langmead
------------------------------
Date: Thu, 22 Oct 1998 08:55:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need help with perl pgm
Message-Id: <MPG.1098f54bbfb17d739898d9@nntp.hpl.hp.com>
In article <F18J5C.LMH@world.std.com> on Thu, 22 Oct 1998 15:32:00 GMT,
Andrew M. Langmead <aml@world.std.com> says...
> tadmc@flash.net (Tad McClellan) writes:
>
> >: while ($line = <InFile>)
> > ^^^^^^^^^^^^^^^^
>
> > That is not '-w clean'.
>
> Depends on which version of perl. It didn't emit a warning up through
> version 5.003, and doesn't give a warning with the current version
> 5.005. In some ways the emitting of a warning in 5.004 could be
> considered a bug in the interpreter.
It was a misfeature, which those of us whose code has to run on many
platforms will be stuck with for a very long time.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 22 Oct 1998 07:22:44 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <uems0isln.fsf@vansel.alcatel.com>
Russ Allbery <rra@stanford.edu> writes:
> Brad Murray <murrayb@vansel.alcatel.com> writes:
> > If you don't understand how to cope with offsets, you should not be
> > programming.
>
> I think you could have made your point without being gratuitously
> insulting. Please at least consider that in the future. Snowhare
> certainly should be programming, and he's been around these parts for
> quite a while, but even that's beside the point. There is absolutely no
> need to be offensive when presenting your side of an argument, regardless
> of who you're arguing with.
That should have read, "If one does not know how to cope with offsets,
then one should not be programming". In other words, it's a general you
and not a specific you. Snowhare was not targeted---anyone who is not
capable of handling offsets was targeted. I don't doubt Snowhare's
abilities, what I doubt is the validity of trying to help the inept
programmers who trip on these things by holding their hands. There are
lots of places in any language that an inpet programmer can trip on.
Programmers need to be able to figure them out.
No insult was intended, except to persons who find addition too complex,
yet want to be programmers. *Some* math is going to be handy in this
field.
--
BMurray Q: "My prostate is swollen and I think it's a networking
SW Analyst problem. Can you help?"
Alcatel A: "Build a free Linux box, relinking the kernel
as follows ..." (Gary Abbott)
------------------------------
Date: Thu, 22 Oct 1998 16:42:38 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <362f6046.2545773@news.ping.be>
Abigail wrote:
>++ I see nothing wrong with year-1900. To get the proper year, just always
>++ add 1900. Not even a problem when comparing dates, unless you go back
>++ before 1900.
>
>There isn't any problem having localtime return numbers in base 17. Or the
>number of years since 1666 squared, minus 1024.
>
>It doesn't make it easy for the programmer though.
I agree with Abigail.
However, I think it's too late to fix it now. Backward compatibility,
you know.
Bart.
------------------------------
Date: Thu, 22 Oct 1998 15:06:59 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <362F478A.B7DFBFB@bbnplanet.com>
David Formosa wrote:
> Isn't the TeX Book published by Addason and Wesley?
Knuth wrote that one, I think, but I was speaking of the tarantula book.
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: Thu, 22 Oct 1998 15:17:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Y2K copmliance
Message-Id: <Pine.GSO.4.02A.9810220817330.5534-100000@user2.teleport.com>
On 22 Oct 1998, Ilya wrote:
> Is Perl 5.003 Y2K compliant on HPUX 20.20? Is version 5.004 compliant?
Is the Perl FAQ Y2K compliant? :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 17:41:37 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: plain text to HTML
Message-Id: <1dhb8sf.kbnvfaqizybbN@host033-210.seicom.net>
Michael Wetzer <mwetzer@fsmat.htu.tuwien.ac.at> wrote:
> so i do substitute a query_string into the real values
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>
> but now I want to substitute plain text to html
> so that "<" becomes "<" and so on for all(?) possibilities
> is there such a routine??
>
> thanks Michael
Instead of using < you could use the numerical representation to do
something like the following:
#!/usr/bin/perl -w
#
# Author : Joergen W. Lang
# Date : September 1998
@special = (grep /\W/, map { chr() } 9,10,32..126,161..255);
# grep-code courtesy of the "perllocale" manpage.
# translate numbers to the characters they represent (chr())
# use only numbers that represent something. (32..126, etc.)
# work only with non-alphnumeric characters (grep /\W/)
# and put them into @special
for (@special)
{
$_ = ord; # translate back to numeric
s/($_)/&#$1;/; # encode in HTML-manner
push @encoded, $_; # for further use
}
# print a HTML-page with all the special chars on it....
open HTML ">special.html" or die "Can't open HTML: $!";
print HTML <<LAST_LINE
<HTML>
<HEAD>
<TITLE>
SPECIAL CHARACTERS
</TITLE>
</HEAD>
<BODY>
@encoded
</BODY>
</HTML>
LAST_LINE
close HTML;
__END__
hth,
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: Thu, 22 Oct 1998 16:49:25 +0200
From: "Avshi Avital" <avitala@macs.biu.ac.il>
Subject: Re: Q:Array of Lists
Message-Id: <70nhfd$kri$1@cnn.cc.biu.ac.il>
>sorry about this question (I'm not familiar with perl), but why doesn't
this
>work ?
>
> @Data[0] = ( "red", "green", "blue" );
> @Data[1] = ( "Apple", "Orange", "Peanuts" );
> print "First: ",$Data[0][0],"\n";
> print "Second: ",$Data[0][1],"\n";
try:
@Data = ( ["red", "green", "blue"],
["Apple", "Orange", "Peanuts"] );
print "First: $Data[0][0]\n";
print "Second: $Data[0][1]\n";
or:
$Data[0] = ["red", "green", "blue"];
$Data[1] = ["Apple", "Orange", "Peanuts"];
print "First: $Data[0][0]\n";
print "Second: $Data[0][1]\n";
Avshalom Avital
Information Retrieval Laboratory
Bar-Ilan University, Israel
avitala@macs.biu.ac.il
------------------------------
Date: Thu, 22 Oct 1998 17:41:51 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Q:Array of Lists
Message-Id: <1dhb9le.1hqbd6yvc8gdsN@host033-210.seicom.net>
<stefan_007@my-dejanews.com> wrote:
> Hi,
>
> sorry about this question (I'm not familiar with perl), but why doesn't this
> work ?
Because you did not use the -w switch on your script.
Because you did not use the "diagnostics"-pragma, which explains
the -w warnings in great detail. To do so, say:
use diagnostics;
Because you did not read the documentation carefully enough.
perldoc perllol
will tell you something important about [_brackets_] which will lead you
to the results you wanted.
> @Data[0] = ( "red", "green", "blue" );
See, what the -w switch tells you about this.
> @Data[1] = ( "Apple", "Orange", "Peanuts" );
> print "First: ",$Data[0][0],"\n";
See, what the -w switch tells you about this.
> print "Second: ",$Data[0][1],"\n";
>
>
> Thanks for your answer,
>
> Stefan.
hth,
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: Thu, 22 Oct 1998 15:04:02 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Reference to a sort function
Message-Id: <F18Huq.LtL@world.std.com>
Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> writes:
> $sorttype = 'backwards';
>
> print sort $sorttype qw( Camel Aardvark Gnu Zebra ), "\n";
>
> sub backwards { $b cmp $a; }
You can also use a glob to get the same effect.
{
local(*sorttype)= \&backwards;
print sort sorttype qw( Camel Aardvark Gnu Zebra ), "\n";
}
--
Andrew Langmead
------------------------------
Date: Thu, 22 Oct 1998 15:49:23 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: sequential line count
Message-Id: <Pine.GSO.4.02A.9810220844030.5534-100000@user2.teleport.com>
On Thu, 22 Oct 1998, Marcus J. Foody wrote:
> This is what I have, everytime $data[2] changes I would like to
> restart the count.
This looks familiar. Haven't I been helping you with this via private
e-mail?
> $sub_cnt++ = $data[2];
Isn't this the line I told you about? That if it actually compiles without
errors on your version of Perl, then you should file a bug report?
Didn't I already tell you that you should keep track of the value of
$data[2] so that you'll know when it changes? And didn't I even send you
some code to do that?
Do you think that it might be helpful to take an introductory course in
programming if this is still confusing to you?
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 15:57:47 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: sort
Message-Id: <Pine.GSO.4.02A.9810220854450.5534-100000@user2.teleport.com>
On 22 Oct 1998, Carl Fox wrote:
> Subject: sort
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> when I searcch for 50, any record with 5000, 500, 50, and 5 pops up.
> Is there any way to get an EXACT match instead of a greater than, less
> than, or equal to?
Isn't a test for "equal to" the same thing as testing for "an EXACT
match"? (At least, if you're comparing strings to strings, or numbers to
numbers.)
But maybe if you show us even one line of code which isn't doing what you
want, we may be able to help point the way. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 15:25:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: trouble reading binary files
Message-Id: <Pine.GSO.4.02A.9810220819250.5534-100000@user2.teleport.com>
On Wed, 21 Oct 1998, seneca wrote:
> # Yes I'd like to read binary files, what I'm I doing wrong?
> $len = 8;
> $fmt = 'B' . $len; # also tried 'b'
So, $len is a number of bits, right?
> while($line = read(IF, $bdata, $len) == $len){
But here you're using it as a number of bytes. Make up your mind already!
:-) And I'd argue that $line is a poor choice of name, since that's
merely going to be a Boolean value, and not even a very useful one.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 22 Oct 1998 14:50:42 GMT
From: Vickie Cooper <vickie.cooper@boeing.com>
Subject: Updating Record Structures?
Message-Id: <362F4642.E0661172@boeing.com>
I want to read in a list of records into an array...but when that record
already exists then update the BYTES field to add the value from the
current record to the existing record.
I created a routine to load the records:
@url_index = ();
sub BuildIndex {
$record = {
URL => $url,
BYTES => $bytes,
HITS => $RecCount++,
};
}
Then I assign :
$url_index[$record -> {URL}] = $record;
Is there a way I can determine if the record already exists as I'm
loading the array...and if so, update that record in place?
Thanks,
Vickie Cooper
------------------------------
Date: 22 Oct 1998 10:11:19 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: What's the "best" way to call one Perl script from another?
Message-Id: <x3yk91sit4o.fsf@tigre.matrox.com>
alfred@hw.stratus.com (Alfred von Campe) writes:
> But using system() to call another Perl script doesn't feel very
> perlish - is there a better (more elegant) way to do it?
do 'file.pl';
--
Ala Qumsieh email: aqumsieh@matrox.com
ASIC Design Engineer phone: (514) 822-6000 x7581
Matrox Graphics Inc. (old) webpage :
Montreal, Quebec http://www.cim.mcgill.ca/~qumsieh
------------------------------
Date: Thu, 22 Oct 1998 15:24:35 GMT
From: dturley@pobox.com
Subject: Re: where download nmake.exe ?
Message-Id: <70nini$qk$1@nnrp1.dejanews.com>
In article <70lm0s$gsn$2@supernews.com>,
bobn@interaccess.com wrote:
> I think it's in the win32 perl distribution that is on CPAN.
>
> - Bob N.
>
> In Article <70ld7v$jkl$1@nnrp1.dejanews.com> , hooni26@my-dejanews.com said:
> : ftp.microsoft.com is not access
> :
> : where is nmake.exe ?
dmake comes with the GS build. I got it there and simple moved the exe and the
startup folder to somewhere in my (windows) path.
I've been told you can find nmake at
ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
cheers,
david
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Oct 1998 15:23:30 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Windows NT and Perl - File Structure - opendir & readdir
Message-Id: <36304d2c.3168466@thunder>
Also Sprach Sam Beam <sbeam@acunet.net>:
>Yes, opendir is totally broken in the AS build
Rubbish. It's just fine in build 504, the slightly older 502, and
even in the 300 series.
[Copying posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: 22 Oct 98 15:34:51 GMT
From: pedantry@your.disposal (momus)
Subject: Re: Windows NT and Perl - File Structure - opendir & readdir
Message-Id: <pedantry-2210981130510001@ppp-5200-2239.mtl.total.net>
In article <362F3E21.EC60981F@ndirect.co.uk_NOSPAM>, Matt Sergeant
<msergeant@ndirect.co.uk_NOSPAM> wrote:
> Sam Beam wrote:
> >
> > Yes, opendir is totally broken in the AS build - my favorite workaround is
> > globs -
>
> [snip]
>
> Correction - was broken. Build 504 is out (use their ftp server as it's
> not shown on their web site) which fixes the problem (which was in their
> ISAPI/PerlScript code, not in perl itself).
Yah, but I'm part of a group, and I don't have direct access or authority
over the servers, so I have to request changes to them. Needless to say I
prefer to find workarounds, because they just can't possibly be more
difficult or time consuming than getting a system admin to make changes to
the server configuration.
:)
(Also, these scripts have to be portable to other servers.)
Thanks for the help guys. I'm going to try the glob shortcut, and if it
doesn't do the job, I'll arm-twist the admin into installing build 504.
M.
------------------------------
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 4045
**************************************