[10262] in Perl-Users-Digest
Perl-Users Digest, Issue: 3855 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 30 07:07:22 1998
Date: Wed, 30 Sep 98 04: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 Wed, 30 Sep 1998 Volume: 8 Number: 3855
Today's topics:
assign name and content of a variable provided from a f <USchimpeler@pfh.sel.alcatel.de>
Re: assign name and content of a variable provided from (Sean McAfee)
Re: BANIP (Marc Bissonnette)
Re: date::manip and GMT/localtime <rra@stanford.edu>
epoch time <kamrani@ifi.uio.no>
Re: epoch time <Tony.Curtis+usenet@vcpc.univie.ac.at>
Excel + OLE: a disaster! <mimmo-nospam@nospam-diemme.it>
Execute perl on win32 with no console? (Martin Oakley)
Re: Getting thePerl script's directory name (Ethan H. Poole)
Hash Arrays rgee@telecom.com
Re: Hash Arrays (Bart Lateur)
Re: Hash Arrays (Lack Mr G M)
Re: Help! How to run a UNIX process in background <howel88@cyberway.com.sg>
how can I build array of lists nfigaro@rocketmail.com
Re: How do I capture a Broken Pipe Error? <erhmiru@erh.ericsson.se>
Re: How do I capture a Broken Pipe Error? (Daniel Pray)
Re: How do I sort a multidimensional array???? (David A. Black)
need a 10 milsec delay <sales@madm.com>
Re: need a regular expressions expert.... (David A. Black)
Re: Need IP Address Sort Subroutine <erhmiru@erh.ericsson.se>
Re: new term for illogical <uri@sysarch.com>
Northern Colorado Perl Mongers: Wed 30 Sep 1998 <gnat@frii.com>
Re: Passing Perl Var To JavaScript - How? <3pound.fuckinspammers.@iname.com>
Re: perl objects and embedding a hash <mpersico@erols.com>
Re: Poll: How Did You Learn Perl? <mpersico@erols.com>
Re: Poll: How Did You Learn Perl? <Geert.Roovers@nospam.com>
Re: Poll: How Did You Learn Perl? (David Adler)
Problem with HTTP::Request::Common <Jon.Hawkes@bigfoot.com>
Re: reducing a variable <mpersico@erols.com>
Re: system function question (Marc Bissonnette)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 30 Sep 1998 07:39:35 +0200
From: "Schimpeler U. DP/EVA" <USchimpeler@pfh.sel.alcatel.de>
Subject: assign name and content of a variable provided from a file
Message-Id: <3611C417.7F44@pfh.sel.alcatel.de>
Who can give a newcomer some useful hints concerning the following
problem:
1. a file contains lines representing a variable's name followed by none
or some values to be assigned; the lines are randomly ordered.
example lines:
var_name_1 para_1a para_1b
var_name_2
var_name_3 para_3
2. the problem: How to define a variable with the name given in column 1
and assign the values stated in the columns following the name?
The result shall be as if i would have written the following code in my
perl script:
@var_name_1 = qw(para_1a para_1b) ;
@var_name_2 = () ;
@var_name_3 = qw(para_3) ;
to allow addressing of the variables directly with their respective
names.
Thank you for your help
Uli
------------------------------
Date: Wed, 30 Sep 1998 06:10:20 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: assign name and content of a variable provided from a file
Message-Id: <gXjQ1.5400$F7.20072041@news.itd.umich.edu>
In article <3611C417.7F44@pfh.sel.alcatel.de>,
Schimpeler U. DP/EVA <USchimpeler@pfh.sel.alcatel.de> wrote:
>1. a file contains lines representing a variable's name followed by none
>or some values to be assigned; the lines are randomly ordered.
>example lines:
> var_name_1 para_1a para_1b
> var_name_2
> var_name_3 para_3
>2. the problem: How to define a variable with the name given in column 1
>and assign the values stated in the columns following the name?
>The result shall be as if i would have written the following code in my
>perl script:
> @var_name_1 = qw(para_1a para_1b) ;
> @var_name_2 = () ;
> @var_name_3 = qw(para_3) ;
>to allow addressing of the variables directly with their respective
>names.
no strict 'refs';
while (<INPUT>) {
($name, @values) = split;
@$name = @values;
}
You're almost certainly better off using a hash approach instead, though:
while (<INPUT>) {
($name, @values) = split;
$table{$name} = [ @values ];
}
Then you'd access what was @var_name_1 as @{$table{'var_name_1'}},
$var_name_1[0] as $table{'var_name_1'}[0], etc.
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 30 Sep 1998 05:00:00 GMT
From: dragnet@internalysis.com (Marc Bissonnette)
Subject: Re: BANIP
Message-Id: <6usdsg$opl$3@news.interlog.com>
In article <36118999.BED79CE7@sneex.fccj.org>, sneaker@sneex.fccj.org says...
>
>Moishe Wasserman wrote:
>>
>> Is there a way to ban someone from an HTML page. I know how to do it in
>> perl, but then I dont know how to call it to the HTML page.
>>
<snip>
>PS - By the time the IP address has seen your Perl script,
>it's prolly already to late...
Unless the HTML page being called was in fact being read by the CGI itself,
i.e., change your root page to index.cgi and do the Perl/IP checking before the
HTML is displayed (Assuming his server supports using index.cgi as a default
document)
--
Marc Bissonnette
InternAlysis
Corporate Internet Research and Results!
http://www.internalysis.com
------------------------------
Date: 29 Sep 1998 22:02:46 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: date::manip and GMT/localtime
Message-Id: <yld88ei45l.fsf@windlord.stanford.edu>
Jeff McClain <hevsys@enteract.com> writes:
> Steve posted this for me. I have one Linux system FTPing a file up to
> another Linux system. In this file is a value of GMT. I need to reflect
> the hours different then localtime.
Why? Why don't you just look at your local time zone setting?
> Your perl script did not do what I needed in fact it gave me 1/1/70
> 00:00 as the GMT time and 6 hours earlier for the local time.
Huh?
>> use Date::Parse;
>> $time = str2time ($date, 'GMT');
>> $localtime = localtime $time;
This script gives you the local time. It doesn't give you a human
readable GMT time. It assumes you already have that. So I don't see how
you're getting an hour difference from that.
If it really returned a time of 0, that means that it couldn't parse your
date format.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Wed, 30 Sep 1998 09:16:57 +0200
From: Kamran <kamrani@ifi.uio.no>
Subject: epoch time
Message-Id: <3611DAE9.2872@ifi.uio.no>
Hi
Is there any function in perl which can read and set the
epoch time, i.e. number of seconds since Jan. 1. 1970 ?
Something like javas Date().
Thanks
Kamran
------------------------------
Date: 30 Sep 1998 09:31:02 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: epoch time
Message-Id: <8390j23vm1.fsf@vcpc.univie.ac.at>
Re: epoch time, Kamran <kamrani@ifi.uio.no> said:
Kamran> Hi Is there any function in perl which can read and
Kamran> set the epoch time, i.e. number of seconds since
Kamran> Jan. 1. 1970 ? Something like javas Date().
Wrong question for perl, it should be "how many ways can I?"
not just "can I?" :-)
==> perldoc -f time
==> perldoc Date::Manip
hth
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: Wed, 30 Sep 1998 12:14:06 +0200
From: Domenico Viggiani <mimmo-nospam@nospam-diemme.it>
Subject: Excel + OLE: a disaster!
Message-Id: <3612046D.5A5BF184@nospam-diemme.it>
I'm trying to use Win32::OLE package provided with Standard Distribution
of Perl (not ActiveState).
My goal is to convert a text file, containing comma-separed values, in a
'true' Excel 97 file.
The following code:
use Win32::OLE;
$ex = new Win32::OLE 'Excel.Application' || die "Impossible initialize
OLE object: $!\n";
$ex->Workbooks->OpenText( {FileName => 'd:\\mimmo\\prove\\ole.csv'} ) ||
do {
$ex->Quit; die "Impossible to open: $!" };
# save and exit
$ex->Workbooks(1)->SaveAs( 'd:\\mimmo\\prove\\ole.xls', 'xlNormal') ||
do{ $ex->Quit; die "Impossible to save: $!" };
$ex->Quit;
doesn't work (die: Impossible to save:...)
Have you any experience?
Thanks in advance.
Mimmo
P.S. Replies better in mailbox (remove -nospam)...
------------------------------
Date: Wed, 30 Sep 1998 05:11:31 GMT
From: martin.oakley@usa.net (Martin Oakley)
Subject: Execute perl on win32 with no console?
Message-Id: <3611b92c.6091717@news.bne.aone.net.au>
Can perl scripts be executed without a console process?
I have implemented PVCS for version control of inhouse application
development. PVCS allows the use of triggers on check-in/out and
promotions. I have implemented the triggers, which compile, set
pemissions etc, using perl.
Problem: Each trigger (pre and post) fires up a console window to run
the perl interpreter. Each console window 'steals' focus, thus making
it impossible to leave the process running in the background and
continue working. In the case of a promotion, there may be 30 or more
files and this can take up to an 1/2 hour or so to complete. The
machine is virtually useless during this time.
I have recently looked at the activeware port becasue it includes
perlscript which is supported by the Microsoft scripting engine for
use with ASP and also client code on I.E.
It seems that because perlscript is registered as a scripting engine,
it should be able to be executed from wscript.exe. It does not seem to
work for me.
Is this even possible?
------------------------------
Date: 30 Sep 1998 05:15:10 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: Getting thePerl script's directory name
Message-Id: <6useou$fft$1@news-2.news.gte.net>
[Posted and Emailed] In article <361155E2.CB719A6E@oxsigen.com>,
bart@oxsigen.com says...
>
>When I write applications that are actually clusters of several
>executables (a main script calls subordinate scripts), I usually
>want to make that cluster relocatable without requiring the user
>to set search paths or special environment variables. In the past
>I have done this by checking a system variable which returns the
>fully qualified path name of the script that is currently running. I
>then strip the directory portion of this path off and use it during
>subsequent calls to subordinate scripts. For example consider
>the following segment of pseudo-code :
>
> $myFileName = getExecutablePath(); # returns full filename for this
>script
> $myDirectory = dirName($myFileName); # returns directory portion
> .....
> system("perl -w $myDirectory/subtask1.pl");
>
>Does anyone know how to do this in Perl ? More specificially,
>how do I do the getExecutablePath() in Perl - I know how do
>do the rest.
sub getExecutableInfo
{
my ($ThisScript, $BaseDirectory, $ScriptName);
$ThisScript = $0;
# Translate all path names to Unix-like (e.g. /dir/)
$ThisScript =~ s/\\/\//g;
($BaseDirectory, $ScriptName) = $ThisScript =~ /(.*)\/([^\/]*)/;
return ($BaseDirectory, $ScriptName);
}
This returns two parts: $BaseDirectory = The directory of the executable.
$ScriptName = Filename (only) of the executable.
The full filename would be "$BaseDirectory/$ScriptName" or $0.
You could split it into the two different parts using two subs if you like,
but this will return everything in one shot.
--
Ethan H. Poole | Website Design and Hosting,
| CGI Programming (Perl & C)..
========Personal========= | ============================
* ehp @ gte . net * | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/
------------------------------
Date: 30 Sep 1998 10:09:57 GMT
From: rgee@telecom.com
Subject: Hash Arrays
Message-Id: <6ut01l$g6d$1@orthanc.reference.com>
I seem to have a bit of a bug in a script I'm writing; ie
# FIND DEPARTMENT HEAD #
%list = (
"Antennas" => "Oliver Leisten",
"Buying" => "Wendy Wright",
"Design Office" => "Geoff Reeves",
"Digital Engineering" => "Martin Hall",
"IT Department" => "Jason Dickie",
"Manufacturing" => "Rose Traynor",
"Quality Department" => "Jason Dickie",
"RF Department" => "Mici McCullagh",
"Sales/Marketing" => "Clive de la Fuente",
"Software Engineering" => "Gerald Whitworth",
"Department Head" => "Originator",
"Senior Management" => "Originator",
);
$depthead = $list{$in{'department'}};
# $in{'department'} is fed from a webpage form
print "$in{'department'}<BR>";
print "$depthead<BR>";
exit;
All I get is the department returned ie Antennas or
Design Office etc but no association value.
If I "hard code" the department name, for example;
$depthead = $list{"Antennas"};
this works! I get both the department and department head name.
Is this a bug? Is there a patch/update?
We are using the latest version of Perl on a UNIX server.
--------------------------------------------------------------------
Posted using Reference.COM http://WWW.Reference.COM
FREE Usenet and Mailing list archive, directory and clipping service
--------------------------------------------------------------------
------------------------------
Date: Wed, 30 Sep 1998 10:55:36 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Hash Arrays
Message-Id: <36130cba.10102739@news.ping.be>
rgee@telecom.com wrote:
>All I get is the department returned ie Antennas or
>Design Office etc but no association value.
>
>If I "hard code" the department name, for example;
>
>$depthead = $list{"Antennas"};
>
>this works! I get both the department and department head name.
There must be SOME difference between the keys of the hash, and the form
supplied value. It could be some form encoding, or some control codes
(newline?) or spaces.
I think you should try looking at the submitted value, as plain text.
I.e.
print "Content-type: text/plain\n\n";
print "input: '$in{'department'}'\n";
as the only thing that gets returned. Now, look very closely at the
returned text. There must be something wrong.
BTW typical English-speaking attitude: you're not HTML-encoding the
plain text into your HTML document. You should. As soon as you get an
accented character, or even a "<" or a "&" in your text, you'll get
weird results.
HTH,
Bart.
------------------------------
Date: Wed, 30 Sep 1998 11:21:47 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Hash Arrays
Message-Id: <1998Sep30.112147@ukwit01>
In article <6ut01l$g6d$1@orthanc.reference.com>, rgee@telecom.com writes:
|>
|> %list = (
|> "Antennas" => "Oliver Leisten",
|>....
|> );
|>
|> $depthead = $list{$in{'department'}};
|> # $in{'department'} is fed from a webpage form
|>
|> print "$in{'department'}<BR>";
|> print "$depthead<BR>";
|> exit;
|>
|>
|> All I get is the department returned ie Antennas or
|> Design Office etc but no association value.
|>
|> If I "hard code" the department name, for example;
|>
|> $depthead = $list{"Antennas"};
|>
|> this works! I get both the department and department head name.
This would seem to indicate that $in{'department'} does not contain
"Antennas". Does it, perhaps, contain a trailing newline (which you
would see if you only ever view the parsed HTML)? What does the *raw*
HTML look like?
--
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
------------------------------
Date: Wed, 30 Sep 1998 17:47:03 +0730
From: Hongwei <howel88@cyberway.com.sg>
Subject: Re: Help! How to run a UNIX process in background
Message-Id: <3612051F.7A43E4C0@cyberway.com.sg>
Chakravarthy KM Nalamotu wrote:
> Hello Perl Users,
> How can I run a UNIX command in the background from a perl script.
> I had no problem doing the same from a korn script.
> I tried the following two, they do not seem to be working.
>
> ------------
> `compress < compress.pipe > split.pipe &`;
> ------------
> `compress < compress.pipe > split.pipe \&`;
> ------------
>
> I appreciate your responses.
>
> Thanx,
> Kittu.
try exec
------------------------------
Date: Wed, 30 Sep 1998 07:25:46 GMT
From: nfigaro@rocketmail.com
Subject: how can I build array of lists
Message-Id: <6usmdq$ju4$1@nnrp1.dejanews.com>
hello,
I'd like to make an array of lists.
( or an array of arrays )
my $list1 = (a b c d);
my $list2 = (1 2 3 4);
and
my @TABLEAU;
@TABLEAU[1] = $list1;
@TABLEAU[2] = $list2;
but it doesn't work.
If anyone could help ,
answer by email please
Nicolas Figaro
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 30 Sep 1998 10:03:07 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: How do I capture a Broken Pipe Error?
Message-Id: <la67e6yqmc.fsf@erh.ericsson.se>
Uri Guttman <uri@camel.fastserv.com> writes:
> >>>>> "RN" == Ramesh Nagarajan <ran@sgi.com> writes:
>
> ramesh,
>
> we appreciate your helping others but this is your second incorrect
> posting in a row. please study up your perl more before you answer
> queries in this group.
Hym. At least you should post a correct hint.
>
> RN> Daniel Pray wrote:
>
> >> How do I capture a Broken Pipe Error and use it to do an action using the
> >> code provided?
> >>
> >> my $name = "filexxxxx";
> >> open(FILE, $name); # Here I want to run a Sub "&whatever" if the file
> >> doesn't get downloaded completely.
> >> print "Content-Type: application/x-stuffit\n";
> >> print "Location: $name\n\n";
> >> close FILE;
>
> what are you trying to do here?
A man is trying to capture a Broken Pipe error, and in case of this error
use a provided code.
OK. Enough. Here is a code which works on UNIX, I don't know anout NT. Anyway
does NT generate Broken Pipe Error?
$SIG{PIPE} = \&whatever;
sub whatever{
my $sig = @_;
print "whatever on SIG$sig\n";
}
Michal
------------------------------
Date: Wed, 30 Sep 1998 08:41:14 GMT
From: daniel@intecomp.com (Daniel Pray)
Subject: Re: How do I capture a Broken Pipe Error?
Message-Id: <daniel-3009980142010001@usr27-dialup20.mix1.sacramento.cw.net>
All I want to do is run a subscript (eg. &senderrormail) if the file
doesn't get downloaded all the way or the user cancels the download.
> >>
> >> my $name = "filexxxxx";
> >> open(FILE, $name); # Here I want to run a Sub "&whatever" if the file
> >> doesn't get downloaded completely.
> >> print "Content-Type: application/x-stuffit\n";
> >> print "Location: $name\n\n";
> >> close FILE;
>
Does this command do this? It looks like this would only show an error if
the file couldn't be open?
open(FILE, ">$name" ) || croak( "can't open $name $! ) ;
Any help?
Thanks,
Daniel
------------------------------
Date: Tue, 29 Sep 1998 18:42:31 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: How do I sort a multidimensional array????
Message-Id: <6urnon$lp8$1@earth.superlink.net>
Steve Maring <smaring@gte-es.com> writes:
>I've tried:
>@array = sort($array[$a][0] <=> $array[&b][0]);
>and
>sort { $a->[0] <=> $b->[0] } @array;
>neither worked.
The first one asks sort() to sort a list consisting of the
truth value of a single comparison. *Definitely* not what
you want.
The second doesn't assign the sorted list to anything. *Ditto*.
So - combining the best of both:
@array = sort { $a->[0] <=> $b->[0] } @array;
David Black
dblack@saturn.superlink.net
------------------------------
Date: Wed, 30 Sep 1998 00:18:03 -0700
From: "Doyle Johnson" <sales@madm.com>
Subject: need a 10 milsec delay
Message-Id: <6usmq3$1id$1@nnrp02.primenet.com>
Hello all,
Since I have been able to get sound advice in here.... I decided to try
again...
I need to be able to ad a 10 milsec delay into a script before exicuting the
next line of code. I have looked into sleep but that is in seconds and that
WAYYY to long. I looked at a few other suggested items and Im not really
sure whats the best.
Can someone please toss out a bit of code that will invoke a less than 1 sec
delay?
Thanks
D.Johnson
------------------------------
Date: Tue, 29 Sep 1998 17:47:51 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: need a regular expressions expert....
Message-Id: <6urki7$f4t$1@earth.superlink.net>
Alan Davis <adavis@tivoli.com> writes:
>I have a need to have a program spit back any string that DOESN'T start
>with "BAD", but I cannot use perl's inherent "!" syntax. Heres the
>simple program I've got:
>------------------
>#!/usr/local/bin/perl
>if (! scalar(@ARGV))
> while (<STDIN>) {
> if ( /^[^B]/) {
> print $_;
> }
> }
>}
>--------------
>**What the above program needs do for me is print back any string that I
>enter except for "BAD".
>Of course there are several problems with the expression above. First
>of all anything that starts with a B is going to automatically be
>filtered out. Secondly, I'm not matching for the second and third
>characters. And third, I'm not matching the whole string "BAD" at the
>same time. However, I've been unable to come up with a way to do this.
>I know that ordinarily I would write the if statement like "if (!
>/^BAD$/)" and I'd be done with it. However, the program that I'm
>calling the rexexp functionality with does not have any operator
>available to provide negation outside of the expression. This has
>proven to be extremely frustrating.
I don't understand that last paragraph. Anyway, why not do:
print unless /^BAD/
?
David Black
dblack@saturn.superlink.net
------------------------------
Date: 30 Sep 1998 12:28:10 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Re: Need IP Address Sort Subroutine
Message-Id: <la3e99zyh1.fsf@erh.ericsson.se>
John Porter <jdporter@min.net> writes:
> Joe Williams wrote:
> >
> > Does anyone have, or can anyone me toward a routine that will sort IP
> > addresses? Many thanks.
>
> I assume you want to sort them numerically.
Why? IP address is a string of four characters. It is better to
sort them as strings.
> You will therefore want to be able to convert dotted-quad
> notation to an integer. The following sub does it:
Why? It cost only time all this calculations. BTW your code do not
work for IP 200.255.255.255. On my machine it returns -1. Anyway, every
address above 127.255.255.255 is 'unsortable' by you. It just 50% of
all addresses so who cares?
>
> sub dotted_to_int {
> return undef if $_[0] =~ /[^0-9.]/;
> my @a = split /\./, $_[0];
> my $n = pop @a;
> return undef unless $n < (256 ** ( 4 - @a ));
> for ( 0..$#a ) {
> return undef unless $a[$_] < 256;
> $n += ( $a[$_] << (8*(3-$_)) );
> }
> $n;
> }
>
> (It actually accepts all valid dotted-number notations,
> not just dotted-quad.)
>
> Then you can use a Schwartzian Transform to do the sort:
>
> @ips_sorted =
> map { $_->[0] }
> sort { $a->[1] <=> $b->[1] }
> map { $_, dotted_to_int( $_ ) }
> @ips;
>
> Hope this helps.
Horror.
>
> --
> John "Many Jars" Porter
Hymm, how about this:
@ips_sorted = sort {pack("C4",split(/\./,$a)) cmp pack("C4",split(/\./,$b))}
@ips;
Should be faster and without this Schwartzian thing (what is it, anyway)?
BTW. Your 'Schwartzian' code does not work for me. I.e. lot of uninitialized
values and result is empty.
Regards,
Michal
------------------------------
Date: 30 Sep 1998 00:44:20 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: new term for illogical
Message-Id: <x74stqus4b.fsf@sysarch.com>
>>>>> "A" == Abigail <abigail@fnx.com> writes:
A> *plonk*
poor abby couldn't handle some acerbic comments back at he/r!
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 29 Sep 1998 13:50:14 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Northern Colorado Perl Mongers: Wed 30 Sep 1998
Message-Id: <5qn27iaebt.fsf@prometheus.frii.com>
The Northern Colorado Perl User Group will be meeting at 6:00pm
Wednesday 30 September, at the Sportscaster Bar and Grill, 165 E
Boardwalk, South Fort Collins. We have half a patio reserved, so if
you can't immediately spot the large collection of geeks, ask a
waitron for directions. We expect to chat and drink until about
8:00pm.
If you have any questions, ask me <gnat@frii.com>.
Cheers;
Nat
------------------------------
Date: Wed, 30 Sep 1998 04:27:42 -0500
From: "Jay" <3pound.fuckinspammers.@iname.com>
Subject: Re: Passing Perl Var To JavaScript - How?
Message-Id: <6ustec$7nv8$1@newssvr04-int.news.prodigy.com>
My first suggestion would be to take a look at CGI.pm
-Jay
Ralph Freshour <ralph@primemail.com> wrote in message
3611a18c.7462898@news.mindspring.com...
>I have a perl/cgi form with some JavaScript in it - I'm trying to pass
>a perl variable to a javascript function and cannot quite figure out
>how to do this. My perl code reads a variable ($usingName) out of a
>file on the server side and I need to pass this value to my JS for
>some checking.
------------------------------
Date: Wed, 30 Sep 1998 00:45:40 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: perl objects and embedding a hash
Message-Id: <3611B774.51E40B74@erols.com>
And after your class has twenty variables and you get tired of writting
get/set functions by hand, grab Class::MethodMaker from CPAN.
But only after you've written a few classes and understand what's really
going on.
--
Get "The Perl Cookbook"
Christansen and Torkington.
O'Reilly. ISBN 1-56592-243-3
FAQ on serious steriods!
------------------------------
Date: Wed, 30 Sep 1998 00:34:16 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <3611B4C8.7D27D8BD@erols.com>
After reading and re-reading Camel in a cursory manner and struggling
through reading a local guru's scripts, I changed jobs.
No more guru.
So, the new job had a script that read sql scripts, parsed them and sent
them to DBI calls. I enhanced it. So now, I have a bit more experience.
Then, I was faced with a re-write of a gnarly piece of 'C'paghetti code.
All this thing was going to do in the end is DBI and system calls.
So, I took the first major project at the new job, about which I had no
business knowledge and decided to write in a language I barely knew.
Perl.
Day 1 and 2 I wrote a bit, designed a bit, figured out how perldb in
xemacs worked and kept reading chapter 2 of camel.
And on day 3 it hit me:
$ = scalar
@ = array
% = hash
\ = ref
Bingo! Touchdown! Thuuuuuuuuuuuuh Yankees Win!
Goooooooooooooooooooooooooooooooooooooooooooooooal!
Four months later I've built 5.005_02 from sources, written 7 modules to
implement the project, thrown out three, have one hash data structure
about five levels deep (und understand it!), created anonymous code
refs, used and understood Schwartzian (spelling?) Transforms, pissed off
the former Perl evangelist of the group at work with my enthusiasm,
returned a patch to Mike Peppler for DBD::Sybase and a patch to the
creator of Class::MethodMaker and have come to the following
conclusions:
C++ is an overblown, underpowered POS
C has only three uses:
source for Unix
source for XEmacs
source for Perl
I also got Panther and the Hall/Schartz book and now have the Cookbook.
Long live Perl.
--
Get "The Perl Cookbook"
Christansen and Torkington.
O'Reilly. ISBN 1-56592-243-3
FAQ on serious steriods!
------------------------------
Date: Wed, 30 Sep 1998 08:30:03 +0200
From: Geert Roovers <Geert.Roovers@nospam.com>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <3611CFEB.E61B6F35@nospam.com>
> rewrite them from scratch? toss them in /dev/null?
>
> they are crappy code at best and buggy at worst. stay away from
> them. there are better programs out there (free and commercial) for all
> of those. they haven't been updated in years nor will they. the fixes
> everyone does keep get reinvented.
Hey.... you make it sound like they're Microsoft products! Matt could
become a billionaire then!
Wait a minute... Matt's Script .... Micro Soft.... MS Windoze wasn't
made by Matt, was it?
~Geert
>
> uri
>
> --
> Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
> uri@fastengines.com http://www.fastengines.com
------------------------------
Date: 30 Sep 1998 06:51:33 GMT
From: dha@panix.com (David Adler)
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <6uskdl$6mv@news1.panix.com>
On Thu, 24 Sep 1998 14:14:16 GMT, droby@copyright.com
<droby@copyright.com> wrote:
>In article <MPG.10730d06c758f81e9896b3@news.south-carolina.net>,
> dragons@scescape.net (Matthew Bafford) wrote:
>
>> => X Camel v.2
>>
>> I read it as a bedtime story. (Strange huh?)
>>
>
>That was my approach to Principia Mathematica.
Eek! The *whole* Principia???
You're scaring me... :-)
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Now everyone, grep your pod, and we'll begin..." - John Porter in
<357FD9DB.2109@min.net>
------------------------------
Date: Wed, 30 Sep 1998 11:38:55 +0100
From: Jon Hawkes <Jon.Hawkes@bigfoot.com>
Subject: Problem with HTTP::Request::Common
Message-Id: <36120A3F.1BBB8561@bigfoot.com>
I've got a problem POSTing files using HTTP::Request::Common. Most of
the
time it works fine but occasionally files get corrupted in transit.
The problem only occurs when the client code runs on Windows, the same
code
works fine on Unix. The code I use is below, can anyone see what I'm
doing
wrong? I can supply a file which always gets corrupted if anyone wants
to
try it. It's a 2MB MS word document.
The client code is:
use LWP;
use HTTP::Request::Common;
my $ua = new LWP::UserAgent;
my @content = ["FileName", ["file.doc"]];
my $req = POST "http://<myserver>/cgi-bin/upload.pl",
Content_Type => 'form-data',
Content => @content;
my $rsp = $ua->request($req);
The server code is:
use CGI qw(param header);
use File::copy;
copy(param("FileName"), "/some/place/else.doc");
print header('text/html');
The problem happens whether the server is on Unix or NT. I'm using the
latest version of Perl from ActiveState for my client code.
Thanks
Jon
------------------------------
Date: Wed, 30 Sep 1998 00:43:15 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: reducing a variable
Message-Id: <3611B6E3.3374C3B5@erols.com>
Hmmm. School started already?
--
Get "The Perl Cookbook"
Christansen and Torkington.
O'Reilly. ISBN 1-56592-243-3
FAQ on serious steriods!
------------------------------
Date: 30 Sep 1998 05:11:47 GMT
From: dragnet@internalysis.com (Marc Bissonnette)
Subject: Re: system function question
Message-Id: <6useij$sau$1@news.interlog.com>
In article <36118ddf.0@news1.ibm.net>, julio13@ibm.net says...
>
>This may be a rookie question but if anyone can help, please do so:
>If I code a while loop, that reads data from a file like this;
>$line = <LSVG_file>;
>while ($line ne "") {
> system("lsvg $line > dummy.out");
> print ($line);
> $line = <LSVG_file>;
>}
Whouldn't it be easier to do (Pardon me if I'm completely off-base here, I'm
far from being a Perl Guru :)
open (FILEIN, $filename);
open (FILEOUT, ">dummy.out");
while (<FILEIN>) {
while $_ ne "" {
print FILEOUT "$_ \n";
}
}
close (FILEIN);
close (FILEOUT);
--
Marc Bissonnette
InternAlysis
Corporate Internet Research and Results!
http://www.internalysis.com
------------------------------
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 3855
**************************************