[11591] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5191 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 21 12:07:27 1999

Date: Sun, 21 Mar 99 09:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 21 Mar 1999     Volume: 8 Number: 5191

Today's topics:
        Accessing NT ACLs remotely <carvdawg@patriot.net>
    Re: convert a file (Bart Lateur)
    Re: Do you know how to install perl on a win95 system? <gellyfish@btinternet.com>
    Re: Do you know how to install perl on a win95 system? (Bart Lateur)
    Re: Do you know how to install perl on a win95 system? (Andri Bell [aka Andre Bell])
    Re: Do you know how to install perl on a win95 system? (Andri Bell [aka Andre Bell])
    Re: Do you know how to install perl on a win95 system? (Andri Bell [aka Andre Bell])
    Re: Forwarding to home directory using Net::FTP (xS)
    Re: Forwarding to home directory using Net::FTP (xS)
    Re: FTP Recursive Directory Listing (xS)
    Re: How to find individual undefined array values? (Bart Lateur)
        How to nicely parse HTML? joe_mccartney@my-dejanews.com
    Re: How to nicely parse HTML? <ebohlman@netcom.com>
    Re: Need Faster Approach <jdf@pobox.com>
        PROBLEM reading file in array <zenno22@hotmail.com>
    Re: PROBLEM reading file in array (Tad McClellan)
    Re: Problems sorting arrays correctly <agjemmes@extremeonline.com>
    Re: RAD or WYSIWIG for Perl ??? ran@netgate.net
    Re: Regex Question <gwilburn@home.com>
    Re: Simple perl question (Bart Lateur)
    Re: sort a 2dim Array (Larry Rosler)
    Re: Which OS am I in (Larry Rosler)
        Win32 Newbie please help (Mike Kirkby)
    Re: || vs "or" (Bart Lateur)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 21 Mar 1999 07:32:15 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Accessing NT ACLs remotely
Message-Id: <36F4A07F.5A9871F6@patriot.net>

I am working on a way to access Registry and Dir/file
ACLs within my domain, all from my box.  I want to move
away from using DumpACL and make it 100% Perl.

Which modules can I use to get the Registry and Dir ACLs?

Again, I need to do remotely...the assumption is that as I
am Domain Admin, I will be able to do so.

Thanks

C



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

Date: Sun, 21 Mar 1999 12:40:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: convert a file
Message-Id: <36f9d959.2107142@news.skynet.be>

chongchanlee@hotmail.com wrote:

>I have a data file written in 16-bit binart little endian format of 43Mb.

>I can't read this file. If anyone knows how to read or convert (if necessary)
>this file, please help me.

16-bit? Two bytes per number? You can read a number like this, using

	read(FILE,$buffer,2); # 2 bytes
	$number = unpack('v',$buffer);  # small integer little endian

	print $number;	#example

>I have Pentium II with 450mh with 256MB RAM in Window NT 4.0.

Ah. Don't forget binmode() on your input file.

There's a lot more to it than just this, but at least this should get
you started.

   HTH,
   Bart.


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

Date: 21 Mar 1999 11:51:25 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Do you know how to install perl on a win95 system?
Message-Id: <7d2mft$5pu$1@gellyfish.btinternet.com>

On Sun, 21 Mar 1999 07:28:45 GMT Andri Bell [aka Andre Bell] wrote:
> 
> I've unzipped perl and installed it using the install.bat file. I can access 
> perl.exe and its functions from the command line, I just can't get it to work 
> within my win95 intranet. I mainly get 501 errors.
> 

You have downloaded the wrong file - the one you want is called APi509.exe
(or something similar) and can be found at:

 <http://www.activestate.com/ActivePerl>

You can simply run the executable file and that will run you through the
installation procedure.

The matter of it running correctly for some HTTP server is however not a 
proper question for this group (despite being answered time and again).

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 21 Mar 1999 12:40:55 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Do you know how to install perl on a win95 system?
Message-Id: <36fbdb69.2634752@news.skynet.be>

Andri Bell [aka Andre Bell] wrote:

>I've unzipped perl and installed it using the install.bat file. I can access 
>perl.exe and its functions from the command line, I just can't get it to work 
>within my win95 intranet. I mainly get 501 errors.

501 errors? Uh... that sounds like a server problem.

Are you using IIS? If so, you have to set up the directory for the
scripts in a rather peculiar way, to get it to run scripts for you: you
need execute permission, but NO read permission.

   HTH,
   Bart.


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

Date: Sun, 21 Mar 1999 14:33:01 GMT
From: andre_perl@ONE-CLICK.COM (Andri Bell [aka Andre Bell])
Subject: Re: Do you know how to install perl on a win95 system?
Message-Id: <7d373p$8aj@sjx-ixn9.ix.netcom.com>

In article <7d2mft$5pu$1@gellyfish.btinternet.com>, Jonathan Stowe <gellyfish@btinternet.com> wrote:
>On Sun, 21 Mar 1999 07:28:45 GMT Andri Bell [aka Andre Bell] wrote:
>> 
>> I've unzipped perl and installed it using the install.bat file. I can access 
>> perl.exe and its functions from the command line, I just can't get it to work
> 
>> within my win95 intranet. I mainly get 501 errors.
>> 
>
>You have downloaded the wrong file - the one you want is called APi509.exe
>(or something similar) and can be found at:
>
> <http://www.activestate.com/ActivePerl>
>
>You can simply run the executable file and that will run you through the
>installation procedure.

Thank you very much. I'll download it now.  I thought it didn't matter which 
version of perl I installed as long as it came from www.perl.com and it was a 
newer version.  I guess I followed a wrong link(?). I'll download the perl 
file from activestate and install it instead.

Thanks very much!

Andre


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

Date: Sun, 21 Mar 1999 14:36:05 GMT
From: andre_perl@ONE-CLICK.COM (Andri Bell [aka Andre Bell])
Subject: Re: Do you know how to install perl on a win95 system?
Message-Id: <7d379h$8aj@sjx-ixn9.ix.netcom.com>

>Are you using IIS? If so, you have to set up the directory for the
>scripts in a rather peculiar way, to get it to run scripts for you: you
>need execute permission, but NO read permission.
>
>   HTH,
>   Bart.

Thanks Bart, I'm thinking I installed perl incorrectly under win95. My 
permissions are set fine. Looks like I may have downloaded the wrong version 
of perl (if the emails I've received are correct).  I'll try again...

Andre'


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

Date: Sun, 21 Mar 1999 14:41:44 GMT
From: andre_perl@ONE-CLICK.COM (Andri Bell [aka Andre Bell])
Subject: Re: Do you know how to install perl on a win95 system?
Message-Id: <7d37k3$8aj@sjx-ixn9.ix.netcom.com>

In article <1a3J2.5$ay6.15@weber.videotron.net>, "S.Faust" <sfaust@isi-mtl.com> wrote:
>http://www.ActiveState.com/
>
>click  the install and that is it

Thanks,
I did that and it wasn't enough. I'm gettting errors that chmod is an invalid 
command.  Is chmod a separate executable file? If so then that is my problem, 
I'm running win95 not unix and I need to download chmod some place. If chmod 
is part of an operating system (like command-line "delete" is part of DOS 
command.com) maybe I need to get that operating system(?). 

I don't know, I'm guessing of course. Maybe this will be resolved when I 
download the perl file from activestate as was suggested. I'll know within the 
next few minutes when I install api...exe.

Thanks again.


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

Date: Sun, 21 Mar 1999 16:28:50 GMT
From: "Kevin S (xS)" <xs@dmusic.com>
Subject: Re: Forwarding to home directory using Net::FTP
Message-Id: <679J2.496$P7.9931@typhoon.mbnet.mb.ca>

It does on most ftp clients because they have code built in to send you to
the specifiied home directory. Unfortunately I couldn't find that code in
any of the ftp rfc's.

'xS

Ray McVay <rmcvay@acm.org> wrote in message
news:36F486FB.C7C9416D@acm.org...
>That sounds like a server config problem to me.  The FTP server should
>initially put you in the home dir of the login user.
>
>"Kevin S (xS)" wrote:
>>
>> Hey,
>>
>> I have had success with Net::FTP on most ftps, yet for some reason it
does
>> not seem to work on ftps where your home directory is not the root dir.
>> Unlike other ftp clients, Net::FTP does not automatically forward you
there,
>> and it does not seem to set a variable as to what the home dir is. I have
>> read the FTP RFC's yet they didn't provide much help.
>>
>> Anyone who can show me perl code, or just the ftp command to use would be
of
>> extreme help.
>>
>> Thanks in advance,
>>
>> 'xS
>> xs AT dmusic DOT com
>
>--
>
>Ray
>+--------------------------------------------------+
>+ I've gone to look for myself. If I should return +
>+ before I get back, keep me here!! - Bill the Cat +
>+--------------------------------------------------+
>
>




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

Date: Sun, 21 Mar 1999 16:43:27 GMT
From: "Kevin S (xS)" <xs@dmusic.com>
Subject: Re: Forwarding to home directory using Net::FTP
Message-Id: <Pk9J2.500$P7.9932@typhoon.mbnet.mb.ca>

I honestly think its a problem w/ Net::FTP, because when I got w/ ftp from
DOS or from Linux it works fine. I think that Net::FTP auto-cwds into the
root dir regardless of who your logged in as. I'll probably look at the
perldoc to see if theres a way to stop this.

Thanks,

'xS
xs AT dmusic DOT com
Jonathan Stowe <gellyfish@btinternet.com> wrote in message
news:7d112i$4n9$1@gellyfish.btinternet.com...
>In comp.lang.perl.misc "Kevin S (xS)" <xs@dmusic.com> wrote:
>> Hey,
>>
>> I have had success with Net::FTP on most ftps, yet for some reason it
does
>> not seem to work on ftps where your home directory is not the root dir.
>> Unlike other ftp clients, Net::FTP does not automatically forward you
there,
>> and it does not seem to set a variable as to what the home dir is. I have
>> read the FTP RFC's yet they didn't provide much help.
>>
>
>It really depends on the FTP server - if you login as a user that has a
>home directory on the server in question and are not placed as your CWD
>into that users home directory then there is something wromg with the ftp
>server and not with anything else.
>
>Do not cross post to alt.perl if you want *me* to see your post.
>
>/J\
>--
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings:
<URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>




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

Date: Sun, 21 Mar 1999 16:41:05 GMT
From: "Kevin S (xS)" <xs@dmusic.com>
Subject: Re: FTP Recursive Directory Listing
Message-Id: <Bi9J2.499$P7.9112@typhoon.mbnet.mb.ca>

I take it alt.perl is frowned upon here. Doesn't matter really. No one every
responds there.

Also do you have any advice on how to determine if an item is a dir or a
file. When I do a $ftp->dir it gives me the following

dr-xr-xr-x 3 0 1 512 Mar 30 1994 usr

I know I can just split the string and go from there but a lot cpu usage
there especially if I did it for more than one ftp per session. Any know any
other ideas?

'xS
xs AT dmusic DOT com

Jonathan Stowe <gellyfish@btinternet.com> wrote in message
news:7d107l$4n6$1@gellyfish.btinternet.com...
>In comp.lang.perl.misc "Kevin S (xS)" <xs@dmusic.com> wrote:
>> Does anyone know how to get the a recursive listing off all the files and
>> dirs on an ftp using Net::FTP?
>
>There is no way I know of directly getting a recursive directory listing
>through the FTP protocol.  What you will have to do is get a directory
>listing for your top level directory and then enter each subdirectory and
>so on and so forth.
>
>Also please do not cross-post to this group and to alt.perl in future if
>you want an answer from *me* as I have kill-filled all such postings.
>
>/J\
>--
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings:
<URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>




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

Date: Sun, 21 Mar 1999 12:40:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How to find individual undefined array values?
Message-Id: <36f6d62d.1302216@news.skynet.be>

David wrote:

>I've looked in my perl book, man pages, and web sites, but I can
>not find out how to check for individual undefined array
>elements? For example:
>$array[5..7]=23,29,44;

Replace the "$" with a "@".

>How do I find out if any other array element is undefined.

Urm... if you what you really want, is to replace the undefined entries
with 0, then this is one way:

	@zeropadded = map { $_ || 0 } @array;

	Bart.


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

Date: Sun, 21 Mar 1999 14:30:55 GMT
From: joe_mccartney@my-dejanews.com
Subject: How to nicely parse HTML?
Message-Id: <7d2vqv$fki$1@nnrp1.dejanews.com>



Is there a way to parse an HTML file so that it gets broken up
nicely, and then I can access the individual elements of the file
like in (say) JavaScript?
I'm writing some "agents" which will fill out forms, submit them, etc.
Currently, it is a pain to manually have to remove the irrelevant HTML tags,
and separate out the tags which are of interest (FORM, INPUT, HREF, etc.)
And then fill in the form automatically, and submit it.
I was wondering if there was an easier way. I fear that I have been
working in isolation, and that Someone out There has already come up
with a neato solution in (of course!) Perl.
Please give this wandering perl newbie some direction...

Joe

PS: Please post; this email thing doesn't work too well...

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


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

Date: Sun, 21 Mar 1999 14:47:05 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: How to nicely parse HTML?
Message-Id: <ebohlmanF8y92H.HyH@netcom.com>

joe_mccartney@my-dejanews.com wrote:
: Is there a way to parse an HTML file so that it gets broken up
: nicely, and then I can access the individual elements of the file
: like in (say) JavaScript?

Yep.  The HTML:: series of modules, available from CPAN.  All of them are 
based on HTML::Parser, which splits your HTML up and calls subroutines of 
your choice for start tags (with attributes already split out for you), 
end tags, text, etc.  If you'd rather have the parser build a tree for 
you, there's HTML::TreeBuilder.



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

Date: 21 Mar 1999 10:31:26 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Need Faster Approach
Message-Id: <m3ww0aoo4x.fsf@joshua.panix.com>

ehood@medusa.acs.uci.edu (Earl Hood) writes:

> In article <MPG.11575678b709089798975d@nntp.hpl.hp.com>,
> Larry Rosler <lr@hpl.hp.com> wrote:

> >How would one use either of those functions effectively to find the 
> >75,000th item in a comma-delimited string, as requested?  Looping 
> >through 75000 index() calls to find the 75,000th comma sounds like a 
> >*very* costly procedure.
> 
> What do you think split does internally?

It certainly doesn't write a Perl loop that calls index() over and
over!  Writing a loop in Perl is much more CPU-burning than calling a
single Perl op.  At any rate, the split() operator accepts a regex as
its first argument, so it can't be implemented using index().

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Sun, 21 Mar 1999 15:41:00 +0100
From: Zenno <zenno22@hotmail.com>
Subject: PROBLEM reading file in array
Message-Id: <36F504DA.BA754D64@hotmail.com>

Hello all,

I am trying to read in a textfile in an array so that

FILE.TXT
line1
line2
line2

becomes

@array = (line1,line2,line3)

My code is:
 ...
(code for opening file etc)
 ...

 while (<EMAILADDRESSES>) {
  $tmp = chomp; #get rid of newline char
  push(@Subscribe_EMail_Data, [@tmp]); #add line as reference to list
print "-" . $Subscribe_EMail_Data . "<BR>";
 }
 ...

(code for closing file and returning array)

But all the print statements prints is lines containing '-'

What am I doing wrong here?

please cc to zmbakker@xs4all.nl

Thanks!



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

Date: Sun, 21 Mar 1999 04:26:32 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: PROBLEM reading file in array
Message-Id: <80e2d7.q43.ln@magna.metronet.com>

Zenno (zenno22@hotmail.com) wrote:

: I am trying to read in a textfile in an array so that

: FILE.TXT
: line1
: line2
: line2

: becomes

: @array = (line1,line2,line3)

: My code is:
: ....
: (code for opening file etc)
: ....

:  while (<EMAILADDRESSES>) {
:   $tmp = chomp; #get rid of newline char
           ^^^^^

   You should read up about functions that you use.

   Particularly when things aren't going right...


   chomp() returns then number of characters removed, which you
   then save in $tmp.

   I doubt that you wanted that.

   You do not need to copy it to $tmp, you can just use $_ directly.


:   push(@Subscribe_EMail_Data, [@tmp]); #add line as reference to list
: print "-" . $Subscribe_EMail_Data . "<BR>";


   You have never put anything into an array named @tmp.

   Here you are making an array of references to anonymous arrays,
   but above you say you want to make an array of strings.

   Which is it?


:  }
: ....

: (code for closing file and returning array)

: But all the print statements prints is lines containing '-'

: What am I doing wrong here?


   So many things that I cannot decipher what it is that you really want.


   I'll make a Wild Ass Guess. Maybe this might kinda sorta do
   what you want?


while (<EMAILADDRESSES>) {
   chomp;                               # remove line ending
   push(@Subscribe_EMail_Data, $_);     # save string in array
}


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 21 Mar 1999 13:26:51 +0100
From: "Asbjorn Gjemmestad" <agjemmes@extremeonline.com>
Subject: Re: Problems sorting arrays correctly
Message-Id: <oB5J2.107$8K1.386@news1.online.no>

Ok, thanx a lot both to you and Andrew - I wasn't aware of the fact that it
only sorted until the first non-numeric character. (Guess I just didn't
quite understand why Andrew wanted me to uise that code, but it all makes
sense now).

You guys just saved my day!

Asbjorn

Jonathan Stowe skrev i meldingen <7d2kv0$5m7$1@gellyfish.btinternet.com>...
>On Sun, 21 Mar 1999 02:22:35 +0100 Asbjorn Gjemmestad wrote:
>>
>> Andrew Johnson skrev i meldingen ...
>
><snipped Andrew's perfectly good solution>
>
>>
>> What I want it to do is simply sort everything with highest number first
for
>> all elements, and correct alphabetically order. I though I'd done that
when
>> sorting and reversing, but when the first numbers (the numbers before the
>> first |) are the same, it goes over to just plain alphabetically order.
>>
>
>The solution that Andrew gave is a perfectly good solution to what you want
>there is no way to sort on this way without first splitting up the input
>into its constituent components.  In the code that you posted anyhow you
were
>using the <=> operator which is a numerical comparison which will only
>take into account anything up to the first non-numeric character - so you
>will only have got the sort on the first column.
>
>If I were you I would try Andrews solution out because it does work ...
>
>/J\
>--
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings:
<URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>




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

Date: Sun, 21 Mar 1999 15:17:54 GMT
From: ran@netgate.net
Subject: Re: RAD or WYSIWIG for Perl ???
Message-Id: <922029474.080.30@news.remarQ.com>

In <7cni7d$s5a$1@camel18.mindspring.com>, "Steve Davis" <stevo@steve.com> writes:

>I want a GUI that will help me assemble the code.. there are dozens of apps
>out there to help me produce java apps but nothing for Perl which surprises
>me.

Different environments:  in DOS,  you needed an IDE because there was no
multitasking,  so it was a major hassle,  requiring that you shut down 
your editing environment,  to do compile-link-test.  In Windoze, 
"Hello, world!" has so much underlying structure you need an IDE to keep
track of the resource files,  module definitions,  etc.  Plus,  a tool 
like VB has the code very intimately bound to the UI,  so it's more 
difficult to separate the code development environment from the GUI one.

In the *nix world that Perl comes from,  you just save the script in one
shell session,  and switch to/start another to test it.  And a simple 
program has very little "bureaucratic overhead" associated with it.  So, 
there's little felt need for an IDE.  The same style is now quite
do-able for OS/2, Windoze, etc., so there's no real incentive there,
either.

If you want syntax highlighting,  linking of error messages to source 
lines,  etc.,  there's probably something available for emacs.  Of 
course,  then you have to learn emacs (the avoidance of which is one of 
my official Goals in Life,  so I can't tell you how well any Perl 
add-in might work...).

>I am clueless when it comes to writing perl from scratch

Do what I do:  grab one of the zillions of provided samples that's near 
what you want to do,  and hack it.  By the time you get to the point of 
wanting to do something radically different,  you'll have gotten the 
hang of what's needed to do it from scratch.

I hope...  ;-)

Ran




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

Date: Sun, 21 Mar 1999 14:15:14 GMT
From: Gene Wilburn <gwilburn@home.com>
Subject: Re: Regex Question
Message-Id: <36F4FEEB.52C86F99@home.com>

Jonathan Stowe wrote:
> 
[snip]

> I'm not entirely sure what it is that you are doing here but just for fun
> here is my take on it (gotta prove I didnt wipe my brain out with beer last
> night :) - It takes the 'cal' output and places it in a two dimensional array
> padding as appropriate ( I have used '*'s to see what is going on but you
> might want to use something else):
> 
[snip]

Nice coding example! It does exactly what I'm looking for. The 'split'
solutions don't work because I'm attempting to preserve blank days in
the array (which you've padded with '*'). Once this two dimensional
array has been built, it provides a perfect map for building an calendar
display in HTML.

Thanks!

Gene

-------------------------------------------------------------------
Gene Wilburn, Northern Journey Online, http://www.interlog.com/~njo
-------------------------------------------------------------------


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

Date: Sun, 21 Mar 1999 12:40:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Simple perl question
Message-Id: <36f7d802.1770946@news.skynet.be>

Kelsang Wangchuk wrote:

>I understand that the line...
>
>    chop($number = <STDIN>);
>
>...removes the carraige return from the input and places the number in
>$number. To me, however, this does not seem intuitive

It's not intuitive, because that's not exactly what it does: it *first*
assigns the line to $number, and *then* it chops of the last character
of the line; usually a newline. Note that newlines are one character,
even on PC's. The are converted from two to one when reading from I/O,
and converted back to CRLF on output.

Another example using the same concept:

	$x = 123;
	($y = $x) *= 2;
	print "\$x = $x, \y = $y\n";

Try it.

	Bart.


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

Date: Sat, 20 Mar 1999 09:47:22 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sort a 2dim Array
Message-Id: <MPG.115d7f094cfac7f398979a@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <36F3D5C4.E9FC83A0@access.ch> on Sat, 20 Mar 1999 18:07:16 
+0100, Philipp Gasser <pgasser@access.ch >says...
> I would like to sort a 2dim array, but only on the column.
> What's the perl syntax?
> sort { $a[1][1] <=> $b[1][1] } @array
> 
> This way doesnt work!

Assuming (from your attempt) that you are trying to sort the array on 
the numerical value of the second element in each subarray, I would 
expect this way to work:

  sort { $a->[1] <=> $b->[1] } @array

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


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

Date: Sun, 21 Mar 1999 06:31:49 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Which OS am I in
Message-Id: <MPG.115ea2aeebdef1b598979e@nntp.hpl.hp.com>

In article <36f8614c.3037187@news.skynet.be> on Sat, 20 Mar 1999 
08:57:42 GMT, Bart Lateur <bart.lateur@skynet.be >says...
> Stephen Montgomery-Smith wrote:
> >> How can a perl program tell whether it is running under DOS
> >> or UNIX?
> >Ignore my question I just found $^O in the documentation.
> 
> I still think it's a valid question. Every Perl port has a different
> name in $^O.
> 
> How can we quickly group them, so that we really now it is Unix(-like),
> don't care if it's Linux or Solaris, or PC-line (Win32, OS2, DOS, ...)? 
> 
> I for one don't really want to include *every* OS-name I could possibly
> encounter.

I answered the original post with $^O a few days ago.  But I don't use 
it myself, for the very reason that Bart states.  I use an empirical 
binary test to distinguish Unix-ish systems from Windows/DOS systems:

$Unix = defined $ENV{TZ};

This *hack* is quite reliable, unless someone has gone out of their way 
to set $ENV{TZ} in your environment on the POB system.

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


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

Date: Sun, 21 Mar 1999 13:40:17 GMT
From: m.kirkby@nof***ingspamukonline.co.uk (Mike Kirkby)
Subject: Win32 Newbie please help
Message-Id: <36f4f3cf.96738093@news.ukonline.co.uk>

I have installed perl, -v gives the following:
This is perl, version 5.004_02

when I try to makefile for any module,
using the command:

perl -w makefile.pl

I get a file created called "makefile" in the same directory

If I then run :

perl -w makefile

I get:
Backslash found where operator expected at makefile line 56, near "blib\"
Semicolon seems to be missing at makefile line 57.
Unquoted string "c" may clash with future reserved word at makefile line
59.
Unquoted string "programs" may clash with future reserved word at makefile
line 59.
Backslash found where operator expected at makefile line 59, near
"programs\"
Unquoted string "perl" may clash with future reserved word at makefile line
59.
Backslash found where operator expected at makefile line 59, near "perl\"
Unquoted string "c" may clash with future reserved word at makefile line
60.
Unquoted string "programs" may clash with future reserved word at makefile
line 60.
Backslash found where operator expected at makefile line 60, near
"programs\"
Unquoted string "perl" may clash with future reserved word at makefile line
60.
Backslash found where operator expected at makefile line 60, near "perl\"
Unquoted string "c" may clash with future reserved word at makefile line
61.
Unquoted string "programs" may clash with future reserved word at makefile
line 61.
Backslash found where operator expected at makefile line 61, near
"programs\"
Unquoted string "perl" may clash with future reserved word at makefile line
61.
Backslash found where operator expected at makefile line 61, near "perl\"
Unquoted string "lib" may clash with future reserved word at makefile line
61.
Backslash found where operator expected at makefile line 61, near "lib\"
Unquoted string "c" may clash with future reserved word at makefile line
62.
Unquoted string "programs" may clash with future reserved word at makefile
line 62.
Backslash found where operator expected at makefile line 62, near
"programs\"
Unquoted string "perl" may clash with future reserved word at makefile line
62.
Backslash found where operator expected at makefile line 62, near "perl\"
Unquoted string "lib" may clash with future reserved word at makefile line
62.
Backslash found where operator expected at makefile line 62, near "lib\"
Unquoted string "c" may clash with future reserved word at makefile line
63.
Unquoted string "programs" may clash with future reserved word at makefile
line 63.
Backslash found where operator expected at makefile line 63, near
"programs\"
Unquoted string "perl" may clash with future reserved word at makefile line
63.
Backslash found where operator expected at makefile line 63, near "perl\"
Unquoted string "c" may clash with future reserved word at makefile line
64.
Unquoted string "programs" may clash with future reserved word at makefile
line 64.
Backslash found where operator expected at makefile line 64, near
"programs\"
Unquoted string "perl" may clash with future reserved word at makefile line
64.
Backslash found where operator expected at makefile line 64, near "perl\"
Bareword found where operator expected at makefile line 85, near "# FULLEXT
= Pathname for extension directory (eg Foo/Bar"
  (Might be a runaway multi-line // string starting on line 65)
        (Missing operator before Bar?)
Backslash found where operator expected at makefile line 90, near
"ExtUtils\"
Bad name after ExtUtils:: at makefile line 92.

Also the relevant file (in this case "asp.pm") is created in the directory
where I ran the program, and does not appear in the Library.
Looking at the script it seems to me that "asp.pm" should be placed into
the library somewhere.

C:\Programs\perl\bin\perl.exe
C:\Programs\perl\bin\perl.dll
C:\Programs\perl\lib\ExtUtils\MakeMaker.pm

etc are all installed

Thanks in advance,

Mike


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

Date: Sun, 21 Mar 1999 12:40:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: || vs "or"
Message-Id: <36fee8ad.6030435@news.skynet.be>

Larry Rosler wrote:

>> You must realize that "=" has a LOWER precedence than "or". So "$b = ''"
>> (that's false) makes "2" to be evaluated. Since there is no side effect,
>> nothing spectacular happens. $b is still an empty string.
>
>You mean a HIGHER precedence.  The assignment ('=') happens before the 
>disjunction ('or') -- it *precedes* it.

Indeed. Big oops. I typed exactly the opposite of what I ment. It shows
more of the human psyche (mine, in this case) than about Perl. The
reasoning must have been something along these lines:

"=" is executed first, it binds tighter than "or". Therefore it has a
higher precedence; this is the traditional sense. "or" dominates the
whole statement: the whole statement is an "or" expression. The
assignment is only a small part of it. This is what made me say what I
said, which is, er, exactly the opposite of the traditional sense.

Damn. :-)

p.s. Apparently your message took 3 whole days to appear on my news
server. Weird.

	Bart.


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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