[12110] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5710 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 18 07:07:20 1999

Date: Tue, 18 May 99 04:00:18 -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           Tue, 18 May 1999     Volume: 8 Number: 5710

Today's topics:
        ==> Returnig Filehandles from Subroutines <== <Andreas.Fischer@germany.Sun.COM>
    Re: A Perl Script <gellyfish@gellyfish.com>
    Re: A Perl Script (Bob Trieger)
        changing drive letters on NT? <jturen@earthlink.net>
        Extracting form fields jenmei@my-dejanews.com
    Re: File with TABS <gellyfish@gellyfish.com>
    Re: free cgi hosting <webmaster@*nospam*mugomilk.freeserve.co.uk>
        Free CGI Server horstr@my-dejanews.com
    Re: Generating data from regular expressions (Bart Lateur)
    Re: help, A Simple Question <vvb@ibm.net>
    Re: How to create passwords in .htpasswd <vvb@ibm.net>
        inserting a byte into a file <akuhn@iphysiolsg1.unil.ch>
    Re: Perl "constructors" armchair@my-dejanews.com
    Re: Perl "constructors" <rra@stanford.edu>
    Re: Perl and Oracle <t.klinger@mobilkom.at>
    Re: Sorting problem <t.klinger@mobilkom.at>
    Re: Using split with map, then join (Larry Rosler)
    Re: Weird socket behaviour <engjs@cc.newcastle.edu.au>
    Re: Your assistance humbly requested (file processing p (Larry Rosler)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 18 May 1999 11:08:43 +0200
From: Andreas Fischer <Andreas.Fischer@germany.Sun.COM>
Subject: ==> Returnig Filehandles from Subroutines <==
Message-Id: <37412E1A.98220FE0@germany.Sun.COM>

Hello,
does anybody know a solution for the following problem?

*************************************************************

open(F, "/usr/text.txt");

 .....
 .....

if(anything)
{
MakeSomthing(*F);
}

sub MakeSomething
{
local(*G)=@_;
 .....
 .....
return(*G);
}

*************************************************************

I want return the filehandle to main on that point where "MakeSomething"
stops.


Thanks in advance

Andi Fischer


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

Date: 18 May 1999 09:41:35 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: A Perl Script
Message-Id: <374127bf@newsread3.dircon.co.uk>

Lone Wolf <lone.wolf@net.ntl.com> wrote:
> Still get the same error message,  Any suggestions before I rebuild the
> server?
> 

I think you will get a better quality from a group such as

   comp.infosystems.www.servers.ms-windows

which is actually concerned with server configuaration issues.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Tue, 18 May 1999 10:50:02 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: A Perl Script
Message-Id: <7hrfdj$jbc$1@holly.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>Lone Wolf <lone.wolf@net.ntl.com> wrote:
>> Still get the same error message,  Any suggestions before I rebuild the
>> server?
>> 
>
>I think you will get a better quality from a group such as
>
>   comp.infosystems.www.servers.ms-windows
>
>which is actually concerned with server configuaration issues.

That was the first suggestion he got from somebody and he considered it 
a flame.




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

Date: Tue, 18 May 1999 02:56:25 -0700
From: James T Uren <jturen@earthlink.net>
Subject: changing drive letters on NT?
Message-Id: <37413949.20E1@earthlink.net>

Hi,
  I am learning Perl on a PC.
  I am able to perform "net view", "net use * \\host\share"
  and etc. But I am curious why I can't select other drive
  letters. I've tried many combinations of 
     system 'g:';
     $COMMAND = "g:"; `$COMMAND`;
     system 'chdir /d g:\\';
  and on and on (and on and on...I'm not good at Perl but I
  am persistent). each time, by invoking
     system 'dir'; 
  I can see that the working directory has not been changed.

  well the work-around is to use the full path name, such
  as g:\path\filename but I am curious why simply specifying
  a drive letter doesn't work. is this just impossible? or is
  there a trick?
Jim Uren



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

Date: Tue, 18 May 1999 08:23:39 GMT
From: jenmei@my-dejanews.com
Subject: Extracting form fields
Message-Id: <7hr82b$see$1@nnrp1.deja.com>

Is there an easy way to extract form fields using Perl?  I'm just
looking for a quick way to automate logging into a Web page (all HTML,
no password dialogs) and submitting a few forms.  I was hoping someone
may have written something that would make this easier.

Thanks!

Jen


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 18 May 1999 09:51:19 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: File with TABS
Message-Id: <37412a07@newsread3.dircon.co.uk>

John Wilkinson <john.wilkinson@soton.sc.philips.com> wrote:
> I need to be able to read in the file and strip off the TABS before I
> add the extension. I have tried using chomp, to no avail.
> 

$filename =~ tr/\t//d;


/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Tue, 18 May 1999 10:51:35 +0100
From: "Mug-O-Milk" <webmaster@*nospam*mugomilk.freeserve.co.uk>
Subject: Re: free cgi hosting
Message-Id: <7hrdb5$vv5$2@news5.svr.pol.co.uk>

One word (well, One URL, anyway!)
www.hypermart.net




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

Date: Tue, 18 May 1999 09:56:40 GMT
From: horstr@my-dejanews.com
Subject: Free CGI Server
Message-Id: <7hrdgo$vng$1@nnrp1.deja.com>

Loads of free webspace providers don't support CGI because it's much to
insecure for them.

In a few month a new service called 'MyCGIServer' will open, which will
provide about 1MB of webspace for your CGI applications like JAVA
servlets, PERL scripts, PHP3s and more.
You can do whatever you want with your account, you can have as many
applications as you like, you can use any PERL commands, there are no
restrictions as long as you will obey the general service rules.
You can build up your site totally dynamically, include counters,
implement feedback forms, and more, use your imaginiation. The best is,
it is totally FREE!

Be sure to check it out as soon as it opens! As there are a lot of
people who are interested in joining, please let us know with an e-mail
if you are interested or not!
We just wanted to let you know because we, the creators, know that
there are only a hand-full of FREE servers out there which support CGI
applications.

The e-mail address is: reiterer@NOSPAMbit-pilots.at (delete "NOSPAM" if
you want to contact us)


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 18 May 1999 08:10:24 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Generating data from regular expressions
Message-Id: <37441847.2251650@news.skynet.be>

Steve Moore wrote:

>I was more interested in the reverse
>operation of pattern matching -- instead of starting with the data in
>question and determining if it matches the pattern, start with the pattern
>and generate a random string that matches it. I didn't want to invent it from
>scratch if I didn't have to.

You don't have to. This question has already been asked a week or two
ago, and in response, Ronald J. Kimball posted source that did just
that. (shuffle shuffle...) foun it. Here are the relevant headers, so
you can look it up (for example in DejaNews):

From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Newsgroups: comp.lang.perl.misc
Subject: Re: Generate matching strings from regex ?
Date: Thu, 6 May 1999 01:35:20 -0400
Lines: 181
Message-ID: <1drcw7f.po7pqv175urimN@p67.block2.tc3.state.ma.tiac.com>

	Bart.


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

Date: Tue, 18 May 1999 12:01:12 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: help, A Simple Question
Message-Id: <37412b11@news.uk.ibm.net>


Larry Rosler <lr@hpl.hp.com> wrote in message
news:MPG.11a9cb7a42731928989a80@nntp.hpl.hp.com...
> In article <373ff3b0@news.uk.ibm.net> on Mon, 17 May 1999 13:52:36
> +0200, Vincent Vanbiervliet <vvb@ibm.net> says...
> > dickyart <dickyart@hkstar.com> wrote in message
> > news:373FD758.A94574AA@hkstar.com...
> ...
> > > $B=(10,9,8,7,6,5,4,3,2,1,'BOOM');
> > > @A=$B;
> > Sam's suggestion is the best, but if you want to use $B (a scalar), and
> > convert it into an array, you could use:
> > @A=split /,/, $B;
>
> Did you try that suggestion out before posting it?  I look in vain for a
> comma in $B to split on.  The value of $B is 'BOOM'.
>
> Compiling the snippet with the '-w' flag would have made clear (to the
> original submitter and to you) what is going on here.
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com

Uhm. Well. You're right. I was trying to answer too fast. My solution would
have wordek if $B was "10,9,...,BOOM".
This should teach me to read a post more carefully :-)

Vincent




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

Date: Tue, 18 May 1999 12:03:33 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: How to create passwords in .htpasswd
Message-Id: <37412b98@news.uk.ibm.net>


Holger Kasten <hkasten@abm-soft.de> wrote in message
news:7hr024$b86$1@black.news.nacamar.net...
> How can I create passwords in a .htpasswd
> file with a perl script???
>
>
Use the crypt function.

Vincent.




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

Date: Tue, 18 May 1999 12:32:45 +0200
From: Alexandre Kuhn <akuhn@iphysiolsg1.unil.ch>
Subject: inserting a byte into a file
Message-Id: <374141CD.5373664B@iphysiolsg1.unil.ch>

Hi,

I am trying to read and write to a file. I thus opened my file with the
following:
open(FILEHANDLE, "+<filename");
I then read several lines until I wish to insert something. As I am
already to far in the file I use a "tell-seek" combination to move back.
The problem is that when I then use a "print" command it only overwrites
the current byte, instead of inserting my byte.
I was adviced to overcome this problem by simultaneously writing a
second file as I am reading the original one. Then print the insertion
to the second one, and complete it by reading-writing the rest of the
original one.
Does a command exist with which I would be able to easily insert
something in my file?

Thanks a lot,

Alexandre



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

Date: Tue, 18 May 1999 09:28:52 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hrbsk$ur3$1@nnrp1.deja.com>

In article <ylk8u8zb2k.fsf@windlord.stanford.edu>,
  Russ Allbery <rra@stanford.edu> wrote:
> armchair <armchair@my-dejanews.com> writes:
> > Russ Allbery <rra@stanford.edu> wrote:
>
> >> Er, why on earth would you write it that way in Perl?
>
> >>
> >> sub first_line {
> >>    my $filename = shift;
> >>    open (FILE, $filename) or return undef;
> >>    return <FILE>;
> >> }
> >> print first_line ('filename');
>
> > You didn't follow my spec,
>
> Yes, I intentionally didn't follow your spec because your spec
> was for a C
> or C++ function, not for a Perl function.

Your extreme partisanship is never more apparent than when you call a
simple generic specification for a function a "C function specification"
and not a "Perl function specification". If I could quote Maynard B.
Krebs - "Don't put Perl in a box, man".

> The answer to your question is
> "you wouldn't do it that way in Perl, normally."
> I *could* write a Perl
> function that did what you wanted, exactly, but it would
> be a lot longer
> than it needed to be and wouldn't look or interact
> like a normal part of Perl.

The answer to my "question", which was had one specific and frustrating
purpose - to get you or anyone else to show me how you would determine
if a hash array entry exists without using exists since you guys
wouldn't do it from a simple request - has already been answered by
Larry Rosler. And at this point, I cannot thank him enough.

>
> > which had a specific purpose, which was not:
> > "how should I solve this
> > particular problem?", but how would you check for a missing hash key
> > without using exists().
>
> No offense, but that's a nonsensical question.
> It's like asking how to
> allocate memory in C without calling malloc().
> To check to see if a hash
> key is there, you call exists().  That's what it's *for*.

You obviously weren't paying attention, because the question only arose
because another Perl advocate said that you didn't need to use exists().
I said "a record has a fixed number of always present fields, whereas in
a  hash the fields are variable and you have to call exists() to find
out of they are present". And I got this answer: "Wrong". Then I had to
set out on the unenviable journey of trying to get someone to say how it
would be done otherwise.

>
> > The filename is inside of a hash that I am passing down
> > as a reference
> > (the hash reference is the first parameter passed down.)
> > And I want to
> > know from the return code exactly what failed - bad value of a
> > parameter, missing parameter, file not readable, file not
> > found. You are
> > only telling me something went wrong.
>
> No, I'm giving you all that information too.  See $!.

Nope, open() does not set errno for "function that called me was not
passed a filename". And open() does not set errno for "file opened
successfully but less than the 800 byte size limit that function that
called me had on it".



> > or, if you don't like that, because I want it done via a return
code.
>
> You can make any language a bear to program in by
> insisting on programming
> conventions that don't fit that language.

If returning a numeric value doesn't fit Perl, than perhaps it should be
removed. If returning a numeric value instead of undef makes Perl a bear
to program then pass me a jar of honey.

>
> > Let me change the spec to say that I want an error returned if
stat()
> > reveals that the file is less than 800 bytes.
>
> That'd be a better reason to pass in the array by reference.
> If I needed
> that, I'd probably have the function return 0 on success
> and an error
> message on failure, which is a bit reversed but works well if
> there's only
> one type of success and a bunch of types of failure.

Did you even read my "spec". I would suggest to you that in almost all
cases, there is only one type of success, and multiple types (reasons
for) of failure.


> > And, as we have standardized here at our hypothetical
> > programming shop
> > that all functions which do not receive parameters
> > that are expected,
> > must return the value 10.
>
> Let Perl figure out if what gets passed in isn't an array.
> Don't test it
> yourself.  The push will fail just fine if someone tries to pass it
> something other than an array.  You'll find that it'll never happen.


>
> Or if you *really* need that testing, do:
>
>         sub first_line ($\@) { ... }
>
> which will make sure, at compile time, that the second argument starts
> with @ and is a literal array, and will give your sub a
> reference to it.

I notice my "missing hash variable in passed hash" got changed to your
"what gets passed in is not an array" in order to make it seem like
Perl's prototyping will catch all invalid parameter function calls. (\@)
doesn't do me any good if I expect element 0 to be a number and element
1 to be a string, and the caller reverses them.

>
> > How is returning undef superior to returning an integer value?
>
> Because you get a three-valued notion of truth.  Both 0 and undef are
> false, but undef is also !defined.  It's very valuable
> for distinguishing
> between expected failure and exceptional failure.

Returning an integer gives you a perfect way to show different types of
failure, and is why I prefer it. Since you (and others here) only return
undef or a success/result , how are you differentiating between
failures?


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 18 May 1999 03:22:22 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl "constructors"
Message-Id: <ylaev21xup.fsf@windlord.stanford.edu>

armchair <armchair@my-dejanews.com> writes:
> Russ Allbery <rra@stanford.edu> wrote:

>> Yes, I intentionally didn't follow your spec because your spec was for
>> a C or C++ function, not for a Perl function.

> Your extreme partisanship is never more apparent than when you call a
> simple generic specification for a function a "C function specification"
> and not a "Perl function specification".

Coming to a discussion with that attitude is going to guarantee that you
will miss my point.  I hate to break this to you, but *you have to program
differently depending on what language you're programming in*.  Perl is no
exception to that.  It's more flexible than a lot of languages, but it's
still *Perl*, not some generic language that can pretend to be C++ one
second and awk the next.

You wanted to pass a struct into a function and get back a numeric return
code.  If you write Perl code like that regularly, you're going to hate
Perl.  Perl has other, better data structures for this.

>> No offense, but that's a nonsensical question.  It's like asking how to
>> allocate memory in C without calling malloc().  To check to see if a
>> hash key is there, you call exists().  That's what it's *for*.

> You obviously weren't paying attention, because the question only arose
> because another Perl advocate said that you didn't need to use exists().

Yes, and you can call brk() in C.  What's your point?  exists() is there
to determine whether a hash key exists, just like malloc() is there in C
to allocate memory.  You can work around it and do things another way, but
there's no *point* under most cases.

> I said "a record has a fixed number of always present fields, whereas in
> a hash the fields are variable and you have to call exists() to find out
> of they are present".

No, you can just access them and see if you get an undefined value back,
because you don't actually *care* if they exist or not.  What you care
about is if they *contain a usable value*.  These are two *completely
different things* in Perl.

> Did you even read my "spec". I would suggest to you that in almost all
> cases, there is only one type of success, and multiple types (reasons
> for) of failure.

You can suggest that to me all you want, but after six years of writing
Perl I can tell you that you normally don't care, even if that's true.

> I notice my "missing hash variable in passed hash" got changed to your
> "what gets passed in is not an array" in order to make it seem like
> Perl's prototyping will catch all invalid parameter function calls. (\@)
> doesn't do me any good if I expect element 0 to be a number and element
> 1 to be a string, and the caller reverses them.

You're worrying about things you don't need to worry about again.  Go
write Perl code for a while.  It's the only thing that's going to convince
you that this is wasted paranoia on your part.

> Returning an integer gives you a perfect way to show different types of
> failure, and is why I prefer it. Since you (and others here) only return
> undef or a success/result, how are you differentiating between failures?

I'm not, because it doesn't matter.  In those cases when it matters, I use
some other mechanism, but 95% of the time I just don't care why it failed.
The program warns at the time of failure so that the user can see
immediately why it failed.

Sure, there are cases when you don't want to do that.  There are cases
when you don't want to do any random thing you normally do.  But you're
trying to talk about a language in general and then ignoring what the
normal case looks like.  It's frankly rather irritating.

-- 
#!/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: Tue, 18 May 1999 10:40:33 +0200
From: "Thomas Klinger" <t.klinger@mobilkom.at>
Subject: Re: Perl and Oracle
Message-Id: <7hr923$7pl$1@fleetstreet.Austria.EU.net>

Thank you!
I'll gonna try.

Thomas

Matthew Evans schrieb in Nachricht <7hpd76$jaq$1@nnrp1.deja.com>...
>Heres an example of a query from a sun to an oracle 8 DB.
>
>#!/usr/local/bin.sun4/perl5
>
>#set up oracle env vars
>$|=1;
>$ENV{'ORACLE_BASE'}="/oracle";
>$ENV{'ORACLE_SID'}="RD02";
>$ENV{'ORACLE_HOME'}="/oracle/oracle8.0.4";
>$ENV{'OH'}="/oracle/oracle8.0.4";
>$ENV{'TWO_TASK'}="RD02";
>
>#Include the libraries
>require 5.0004;
>use lib "/home/project/stats/lib/perl5/site_perl";
>use lib "/home/project/stats/lib/perl5/site_perl/sun4-solaris";
>use DBI;
>use English;
>
>#log-in to oracle
>$db = "";
>$db = DBI->connect("dbi:Oracle:", "stats/stats", "") || &errprn
>($DBI::errstr);
>$db->{LongTruncOk} = true;
>$db->{LongReadLen} = 10000;
>
>#get data from oracle
>$sql = "SELECT IP FROM AAHOST WHERE IP = \'194.222.77.192\'";
>
>$get_csr = $db->prepare($sql) || &errprn($DBI::errstr);
>$get_csr->execute || &errprn($DBI::errstr);
>($ip) = $get_csr->fetchrow;
>print "IP >: $ip\n";
>
>
>#########################
># Starts the subroutines#
>#########################
>
>sub errprn
>{
> my($stin) = @_;
>
> open(LOG, ">>/home/project/stats/logs/summary.log")||die("Cant
>open error file");
> $sysdate = `date`;
> print LOG ("$sysdate: $stin occured\n\n");
> close(LOG);
> exit(-1);
>}
>
>
>Hope  this helps,
>
>Matt
>
>
>In article <7hogqn$8ni$1@fleetstreet.Austria.EU.net>,
>  "Thomas Klinger" <t.klinger@mobilkom.at> wrote:
>> Hi there!
>>
>> Maybe this might be a simple question but because I'm a bit new to
>PERL I
>> cannot answer myself.
>>
>> I have a system on HPUX 10.20, clustered with MC/SG, with a comm-, a
>db- and
>> a spare-package.
>> Additional I use a Linux system with an Apache-webserver.
>> Those 2 systems are connected within a large TCP/IP net.
>>
>> What I want to do is doing some SQL-queries from a CGIscript on my
>Linuxbox
>> on the db-package(btw, the db-package is an ORACLE database, version
>7.3.2).
>> I know that I have an installed DBI package and a DBD:Oracle package.
>> But how do I have to work with? How does the connection string is
>looking
>> like?
>> What environment have I to build that my project would work exactly?
>>
>> Every message is welcome. Please excuse my sometimes worse English.
>>
>> --
>> Best regards,
>>                   Thomas Klinger
>> ========================================
>> ......E-Mail: t.klinger@mobilkom.at.....
>> .........WWW: http://www.mobilkom.at....
>> ========================================
>>
>>
>
>
>--== Sent via Deja.com http://www.deja.com/ ==--
>---Share what you know. Learn what you don't.---




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

Date: Tue, 18 May 1999 10:59:14 +0200
From: "Thomas Klinger" <t.klinger@mobilkom.at>
Subject: Re: Sorting problem
Message-Id: <7hra54$8s3$1@fleetstreet.Austria.EU.net>

Arjun Ray schrieb in Nachricht <37d5f89d.2693474261@news1.newscene.com>...
>In <m1vhdrm4jj.fsf@halfdome.holdit.com>,
>merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>
>| Naaah... I'd go with more of:
>|
>|     print
>|       map "<tr>$_</tr>",
>|       map { join "", map { "<td>".(/^$/ ? "-" : $_)."</td>" } @$_ }
>|       sort { $b->[2] <=> $a->[2] }
>|       grep { $_->[1] =~ m/$FORM{'TNSET'}/i }
>|       map { chomp; [ split /;/ ] }
>|       @techlines;
>
>Hey, pretty cool. (Reminds me of APL!)
>
>I suppose the only thing that might be dodgy is the 'join ""' part.
>Wouldn't a strategic 'print @array' take care of this automatically?
>(Also, looking back at Thomas' problem, there's also the cases from
>split dropping trailing delimiters, whereas the sorry state of current
>browsers generally behooves us to get the number of <td>s right.) So,
>how about this
>
>    print
>      map  { ('<tr>', @$_, '</tr>', "\n") }
>      map  { [ map { '<td>'.(/^$/ ? "-" : $_).'</td>' } @$_ ] }
>      sort { $b->[2] <=> $a->[2] }
>      grep { $_->[1] =~ m/$FORM{'TNSET'}/i }
>      map  { chomp; [ split /;/, $_, 8 ] }
>      @techlines;
>
>| But no, that's not the canonical Schwartzian Transform either, not
>| as coined by Mr. Christiansen.
>
>Well, it starts with a map, has a sort somewhere, and ends with a map.
>Good enough for me...
>
>
>:ar


Well, I don't want to disturb a deeply philosophical discussion on sorting
:) but the last 3 posting were completly too high to me (as I am new at PERL
and no perlhacker (learning nealry 1 year but can't guess what I'm doing
[:)])).
Anyway, the article from tbsmith@deltacom.net answered my question in a way
I can reproduce and sounds easy to me.

Now, how should I work to get the orderdescending (700, 699, 698, ....)
instead of 698, 699, 700?

BTW: Thanks to Randal Schwartz. I'm trying hardly to read your perlbook(s)
and I still think that he's one of the best teachers out there.

Best regards,
                  Thomas Klinger
========================================
 ......E-Mail: t.klinger@mobilkom.at.....
 .........WWW: http://www.mobilkom.at....
========================================




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

Date: Tue, 18 May 1999 01:15:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Using split with map, then join
Message-Id: <MPG.11aac18018e75f32989a91@nntp.hpl.hp.com>

In article <7hqlq9$g50$1@nnrp1.deja.com> on Tue, 18 May 1999 03:12:10 
GMT, tbsmith@deltacom.net <tbsmith@deltacom.net> says...
> In article <7hq85h$78f$1@nnrp1.deja.com>,
>   lou@visca.com wrote:
 ...
> looks fine to me, but if you wanted it all in one line, do this
> (untested):
> 
> print join '|', grep /./s, map {(split /\|/)[0,3..6], "\n"} @data;
> 
> If that's not what you were talking about, ... uh ... sorry.

Well, at least you admitted you didn't test it, unlike the others who 
posted bugs.  :-)

This puts a '|' at the end of each line.  Also, the 'grep' eliminates 
empty fields completely, and I'm not sure why you want to do that.
 
> > ----------
> > prints:
> > #1001|Barbie in Mexico|NRFB|1|$250
> > #1002|Dreamboat|NRFB|1|$80
> > #1004|Ken in Mexico|NRFB|1|$175

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


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

Date: Tue, 18 May 1999 20:49:27 +1000
From: James Smith <engjs@cc.newcastle.edu.au>
Subject: Re: Weird socket behaviour
Message-Id: <374145B7.304C1455@cc.newcastle.edu.au>

Michel Dalle wrote:
> 
> In article <37402EB8.AE83A315@cc.newcastle.edu.au>, James Smith <engjs@cc.newcastle.edu.au> wrote:
> >I have written a perl program to open an internet socket and download
> >a webpage, the sort of thing Netscape does. It works fine in some cases
> >and not in others. The problem appears to be with the site I am
> >downloading from (which is one of a number of such sites).
> [snip]
> 
> Have you looked at the actual contents of the page (View Page Source) ?
> - Does it contain JavaScript ?
> - Does it use style sheets ?
> - Does it contain objects, Java applets, RealAudio, MIDI, ...?

Yes. No. No. No. In any case, the basic page would be the same
in all cases except that it would be missing some elements. I know
enough to be fairly sure that this is not where the problem lies.
(The two different pages refer to totally different companies.)

> Have you tried downloading the page with Netscape after disabling JavaScript ?

No, but I'm fairly sure this is not where the problem lies.

> Does your perl program send back a UserAgent together with the
> HTTP request ? Does the server check that UserAgent (e.g. CGI) ?
> (not likely, but who knows...)

I've tried setting it up to send exactly what Netscape sends, to no
effect. I have no idea what the server does.

> Do you use a proxy server to access the Internet ?

No.

> Does the webserver send back a cookie ?

No.

> Have you looked at the LWP module on CPAN ?

No, only the examples in the book.

> All of the above should tell you that it may be 'difficult' to obtain exactly
> the same page via a perl script as you'll get with Netscape.

I'm pretty sure that it's not a case of obtaining the right page
but having it appear wrong. Rather, Netscape is returning a different
page. I'm pretty sure it's something to do with the way the address 
is translated--Netscape is doing something extra that I don't know
about.

Jim


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

Date: Tue, 18 May 1999 01:06:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Your assistance humbly requested (file processing problem)
Message-Id: <MPG.11aabf4d78eba698989a90@nntp.hpl.hp.com>

In article <MPG.11aa954b659c9705989a8c@nntp.hpl.hp.com> on Mon, 17 May 
1999 22:06:55 -0700, Larry Rosler <lr@hpl.hp.com> says...
 ...
> for my $length (@initialize) {
> 	if ($length < 0) {
> 		<DATA> || last while $length++;
> 	} else {
> 		print <DATA> || last while $length--;
> 	}
> }	

What I wrote is correct, but the following bails out faster on premature 
EOF in the input data:

  LOOP:
  for my $length (@initialize) {
  	if ($length < 0) {
  		<DATA> || last LOOP while $length++;
  	} else {
  		print <DATA> || last LOOP while $length--;
  	}
  }	

Except for all that EOF stuff, Tad McLellan and I wrote the identical 
code.  Who says TMTOWTDI?  :-)

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


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

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

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