[8745] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2362 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 19 06:07:33 1998

Date: Sun, 19 Apr 98 03:00:25 -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           Sun, 19 Apr 1998     Volume: 8 Number: 2362

Today's topics:
        A.B.I.G.A.I.L. <sowmaster@juicepigs.com>
        Are there things NOT answered yet ? <birgitt@order.booktraders.com>
    Re: Are there things NOT answered yet ? (Craig Berry)
    Re: Are there things NOT answered yet ? (Chris  & Sheila King)
        getting object size? <otis@POPULUS.net>
        Help, I'm going Perl-bald! msbzdragn@hotmail.com
    Re: How to skip HTML codes? (Abigail)
    Re: How to skip HTML codes? <dtbaker_@flash.net>
    Re: Implementation of map. <richard@cs.newcastle.edu.au>
    Re: keys in hashs (Andrew M. Langmead)
    Re: Lexers / tokenizers in Perl <ajh@rtk.com>
    Re: Multiline RegExp problem (Abigail)
    Re: OOPerl/References Misunderstanding (Andrew M. Langmead)
    Re: perl/shopping cart <wpshaf@gte.net>
        Piping to Awk Problem <tclaydon@troika.net>
    Re: Project question and gripe about (Re: Snobby news g <markc@renta.net>
        Q: ways to get text file content <xah@best.com>
    Re: Q: ways to get text file content (Craig Berry)
    Re: shorten array <star@sonic.net>
    Re: Snobby news group <markc@renta.net>
        Sorting Arrays to Numbers <r.tsch@gmx.net>
    Re: Sorting Arrays to Numbers (Craig Berry)
        Text box alignmnet <wpshaf@gte.net>
    Re: Text box alignmnet <sowmaster@juicepigs.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 19 Apr 1998 00:47:17 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: A.B.I.G.A.I.L.
Message-Id: <353981D5.221A@juicepigs.com>

To those of you that haven't figured it out yet. A.B.I.G.A.I.L.
(Automatic Blurb Issuer Greeting All Interested Learners).

 This Bot is programmed with only a few blurbs, IE "It's in the FAQs" &
"RTFM". But many taglines.

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Sun, 19 Apr 1998 01:15:37 -0400
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Are there things NOT answered yet ?
Message-Id: <35398879.1997B287@order.booktraders.com>

I try to take the constant reminder of the experts
serious to read the FAQ, DOCs, books etc. before posting
anything here. So I read this group for a couple of weeks. 

Now I happen to know someone who told me he started to learn
Perl seriously around mid 1995 and he posted a lot in this
group. I studied his posts and I didn't find *ONE* question,
just answers.

Which leads me to ask if there is really something left which
has NOT been answered in clpm. 

Logically this would mean any question could be answered with
the advice to "read the clpm archives". 

Birgitt Funk  
E-mail is an open duct into your central nervous system. 
It occupies the brain and reduces productivity. (Michael Dertouzos, MIT)


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

Date: 19 Apr 1998 07:43:55 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Are there things NOT answered yet ?
Message-Id: <6hc9vs$7pi$1@marina.cinenet.net>

Birgitt Funk (birgitt@order.booktraders.com) wrote:
: Which leads me to ask if there is really something left which
: has NOT been answered in clpm. 

As a matter of fact, that very question -- 'Are there any remaining
legitimate questions left to ask on c.l.p.m?' -- was the only remaining
legitimate question to ask on c.l.p.m.  Now that it has been asked, and
answered (which I'm doing now), the work of this newsgroup is done.  The
FAQ and DejaNews contain all wisdom; any attempted post to c.l.p.m from
this moment forward should be blocked (and autoreplied to with an email
mentioning the FAQ and DejaNews). 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sun, 19 Apr 1998 08:01:07 GMT
From: cking@wenet.net (Chris  & Sheila King)
Subject: Re: Are there things NOT answered yet ?
Message-Id: <353baf0a.90071678@news.wenet.net>

On Sun, 19 Apr 1998 01:15:37 -0400, Birgitt Funk
<birgitt@order.booktraders.com> wrote:

:I try to take the constant reminder of the experts
:serious to read the FAQ, DOCs, books etc. before posting
:anything here. So I read this group for a couple of weeks. 
:
:Now I happen to know someone who told me he started to learn
:Perl seriously around mid 1995 and he posted a lot in this
:group. I studied his posts and I didn't find *ONE* question,
:just answers.
:
:Which leads me to ask if there is really something left which
:has NOT been answered in clpm. 
:
:Logically this would mean any question could be answered with
:the advice to "read the clpm archives". 

In that case, let's rm clpm.


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

Date: Sun, 19 Apr 1998 01:34:02 -0400
From: "Otis Gospodnetic" <otis@POPULUS.net>
Subject: getting object size?
Message-Id: <6hc2ko$58j5@tortola.acunet.net>

Hello,

I was wondering how I could determine the size (number of bytes or something
or something like that) that a perl object is consuming....is that possible?

I'm storing some perl objects on disk and noticing that each of them is
30-50K or so, but that could also be due to the way I'm storing objects
(using MLDBM)... so I'd like to check what is the 'raw' size of perl objects
that I am saving.

Thanks,

Otis




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

Date: Sun, 19 Apr 1998 02:18:19 -0600
From: msbzdragn@hotmail.com
Subject: Help, I'm going Perl-bald!
Message-Id: <6hc8fr$5p$1@nnrp1.dejanews.com>

Heeeeeelllllppp!!!!!

I'm going bald prematurely, and all because I've just become a newbie... ;)  I
just started playing around with Perl and CGI for a project I am trying to do
at work, and I'm completely baffled...

I've got a web server (Sambar, http://www.sambar.com) running on Windows NT
Server 4.0, using the included Perl executables - and CGI works fine, so long
as I use the included scripts.  However, I haven't been able to get any of the
scripts I've downloaded off the web (such as Webbbs and a few other similar
message-board systems, downloaded from http://www.cgi-resources.com) to work.

I don't get any error message, in fact I don't get anything at all on the
scripts that I am trying to install - the browser just sits and eventually
times out.  Where am I going wrong?

I'll be happy to give any information that might help track down where I've
tripped over and landed on my newbie-face - I am quite sure I am just doing
something embarrassingly obvious wrong, but there's the joys of teaching
yourself this sorta stuff I guess...

Cheers

---
Mike

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 19 Apr 1998 04:03:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to skip HTML codes?
Message-Id: <6hbt2e$ks0$1@client2.news.psi.net>

Noel Sampol (noels@chilli.net.au) wrote on MDCXCI September MCMXCIII in
<URL: news:892855951.821756@ajatar.dragon.net.au>:
++ Hi,  I'm trying to write a CGI script that basically ignores and skips past
++ HTML code - anything and including between < > like <p align=center>.
++ 

That's answered in the faq.



Abigail
-- 
perl -pwle '$_ .= reverse'


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

Date: Sat, 18 Apr 1998 22:24:59 -0600
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: How to skip HTML codes?
Message-Id: <35397C9B.53FF@flash.net>

Abigail wrote:
> 
> Noel Sampol (noels@chilli.net.au) wrote on MDCXCI September MCMXCIII in
> <URL: news:892855951.821756@ajatar.dragon.net.au>:
> ++ Hi,  I'm trying to write a CGI script that basically ignores and skips past
> ++ HTML code - anything and including between < > like <p align=center>.
> ++
> 
> That's answered in the faq.
------------

since you are obviously knowledgable, and took the time to post a reply
Abigail.... why don't you give just a tad more information... like WHAT
faq it might be in so that interested people can actually go and read up
rather than just still feel lost and frustrated?! In the ten seconds it
took you to reply, you could have spent 2 more seconds and identified
the specific FAQ, or at least the library to go read...

Most of the newbies aren't COMPLETELY lazy, we just are so overwhelmed
by the volume of FAQs and coumentation available that we don't know
where to look. It does very little good to make us feel stupid, we'll
just keep asking the same question unless someone points to the
information.

Don't get me wrong, I appreciate your experience with perl, but would
appreciate it even more if you could be more specific when refering
people to FAQs.

Dan


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

Date: Sun, 19 Apr 1998 15:05:01 +1000
From: Richard Webber <richard@cs.newcastle.edu.au>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Implementation of map.
Message-Id: <353985FD.1129@cs.newcastle.edu.au>

Randal Schwartz wrote:
> 
> > Does the builtin map function guarantee that it will process
> > each element of a list in order (actually process, not just output)?
> > This is important if you want the block passed to map to have
> > side-effects.
> 
> Yes.  It's guaranteed.  Or at least, even if it isn't, there are so
> many programs now that presume it that changing that would break
> everything.

Thanks Randal.

Actually, I found a posting on Dejanews that claims the
foreach/push approach is faster than map. I'll have to check it
out once I have time to worry about these things again.

Richard (conference deadline in 1 week, and still writing my thesis!)

-- 
Richard Webber              .-_|\      Department of Computer Science
room: ES237                /     \       and Software Engineering,
phone: +61 2 49216034      \.--._/ <-- University of Newcastle,
fax: +61 2 49216929             v      Callaghan 2308, Australia
mailto:richard@cs.newcastle.edu.au
http://www.cs.newcastle.edu.au/~richard/
Caffeine -> Thesis -> Job -> Melbourne -> Love -> Life


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

Date: Sun, 19 Apr 1998 08:08:10 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: keys in hashs
Message-Id: <ErnILM.8p9@world.std.com>

mpslon01@msuacad.morehead-st.edu (MICHAEL PATRICK SLONE) writes:

>I haven't tried this on any other versions of perl (or operating systems: this
>was on HP-UX 9.0), but I would suspect similar behavior would occur.

>Transcripts of counterexamples to this counterexample, along with information
>on OS and perl version would be appreciated.

Since the version of perl you used seems to have a copyright
notification from four years ago, isn't it much more likely that this
is a bug that has been fixed?

Script started on Sun Apr 19 04:02:21 1998
~/tmp>/usr/local/bin/perl5.001 -v

This is perl, version 5.001

        Unofficial patchlevel 1l.

Copyright 1987-1994, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
~/tmp>!!:0 proof
/usr/local/bin/perl5.001 proof
Ambiguous use of {shift} resolved to {"shift"} at proof line 4.
shift
~/tmp>/usr/local/bin/perl5.003 -v

This is perl, version 5.003 with EMBED
        built under irix at Jul  3 1996 12:52:37
        + suidperl security patch

Copyright 1987-1996, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

~/tmp>!!:0 proof
/usr/local/bin/perl5.003 proof
Ambiguous use of {shift} resolved to {"shift"} at proof line 4.
shift
~/tmp>/usr/local/bin/perl5.004 -v

This is perl, version 5.004_01

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

~/tmp>!!:0 proof
/usr/local/bin/perl5.004 proof
Ambiguous use of {shift} resolved to {"shift"} at proof line 4.
shift


-- 
Andrew Langmead


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

Date: Sat, 18 Apr 1998 20:50:41 -0700
From: "Aaron Harsh" <ajh@rtk.com>
Subject: Re: Lexers / tokenizers in Perl
Message-Id: <6hbsci$gom$1@brokaw.wa.com>


Mark-Jason Dominus wrote in message <6hbdnm$6nt$1@monet.op.net>...
>My Perl Line of the Day page usually discusses some interesting or
>charming trviality.  Today, however, it demonstrates an extremely
>powerful technique for writing good lexers in Perl.  It shows a
>complete lexer for a calculator program.  The lexer is one line long.
>
>Details and discussion at
>
> <URL:http://www.plover.com/~mjd/perl/LOD/>


Very nice!! (Both LOD page and the lexer example).  I love the way you made
the regexp completely readable.  Your code is going up on my wall, next to
the Monet :-)

When I've done this sort of thing, I've always used the /g option on the
match operator, rather than split:

  @tokens = ( $text =~ /
                        (
                          :=    # assignment operator
                        |
                          \*\*  # double pointer dereference :-)
                        |
                          [a-z_]\w*   # identifier
                        |
                          [-+*/%]     # single-char operators
                        |
                          ..yada yada..
                        |
                          \S    # catch invalid characters
                        )
                       /gxi );

which has the advantage of stripping out the whitespace for you.

The only caveats are that you have to stick the \S at the end to catch
invalid characters, and that there's no easy way to tell what line a token
was on without the whitespace.

--
Aaron Harsh
ajh@rtk.com




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

Date: 19 Apr 1998 04:06:08 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Multiline RegExp problem
Message-Id: <6hbt7g$ks0$2@client2.news.psi.net>

Tomi Tuominen (Tomi.Tuominen@iki.fi) wrote on MDCXCI September MCMXCIII
in <URL: news:35387CB9.B0FC194B@iki.fi>:
++ Hi there!
++ 
++ My goal is to make a script which reads files specified
++ in the command line and then remove first (and _only_ first)
++ comments.
++ 
++ ...but could not came up with good regexp to match
++ standard C comments.


That's answered in the FAQ.


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Sun, 19 Apr 1998 08:23:08 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: OOPerl/References Misunderstanding
Message-Id: <ErnJAK.DHz@world.std.com>

fakeuser@fakemail.com (Ed.Q.Bridges) writes:

>    @ListOfAnswers = ( 'A', 'B', 'C' );
>    $Q = new Question( $fh, $Qname, $Index, $#ListofAnswers+1,
>@ListOfAnswers );

>    @ListOfAnswers = ( ['A', 'B' ], ['A', 'B', 'C'] );

OK, so @ListOfAnswers is an array consisting of two scalars. Each
scalar is a reference to an array.

>    
>    for $i ( $[ .. $#Qnames ){
>	$Questions[$i] = 
>		new Question( $fh, $Qnames[$i], ($Index+$i),
>			$#{$ListOfAnswers[$i]}+1, $ListOfAnswers[$i]);
>    }

So here, in the fourth argument you Take an element out of the array
@ListOfAnswers, dereference it to get the underlying array, get the
highest array element, and add one to it. But with the fifth argument,
you don't dereference $ListOfAnswers[$i], you just pass the scalar
that contains the reference.

  new Question( $fh, $Qnames[$i], ($Index+$i),
      $#{$ListOfAnswers[$i]}+1, @{$ListOfAnswers[$i]});
-- 
Andrew Langmead


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

Date: Sat, 18 Apr 1998 19:11:58 -1000
From: "William Shaffer" <wpshaf@gte.net>
Subject: Re: perl/shopping cart
Message-Id: <6hc3gg$l9v$1@gte2.gte.net>

Hi Ion

    Go to http://www.arpanet.com/PerlShop/perlshop.html. PerlShop is pretty
to setup and is free. Complete instruction are online. The only major
problem I had was my old ISP would give me his configuration so I could
setup PerlShop. My new ISP, www.dezines.com, has a demo PerShop cart on
their site. I copied their configuration, input my URL's and Perlshop works.

    Bill

Ion Chalmers Freeman wrote in message <3526cd04.0@news.prostar.com>...
>Bill,
>    I did a search on your behalf on Amazon.com. _Cgi _For _Commerce sells
>for $30.
>ion
>http://www.amazon.com/exec/obidos/ISBN%3D1558515593/
>
>
>tiles@pyramidtile.com wrote in message <6g59m3$mlr$1@nnrp1.dejanews.com>...
>Does any body know of a person or persons that give training for Perl/web
>and
>shopping cart instructions over the phone or email?
>I would like to learn how to set up my own shopping cart on my web site.
>I know how to make web pages and just learned to telnet to my shell server.
>But would like to learn how to customize my web pages so that browsers
could
>order my selection of tools.
>
>I just don't wan't to travel to places and spend ton's of money to lean how
>to
>set up a shopping cart.
>Is there an economical way of doing this?
>Thanks
>Bill
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/   Now offering spam-free web-based newsreading
>
>




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

Date: Sat, 18 Apr 1998 21:34:17 -0800
From: Tom Claydon <tclaydon@troika.net>
Subject: Piping to Awk Problem
Message-Id: <35398CD8.F6C86D49@troika.net>

Hello all. I am also a newbie working with Perl, and I've got a small
problem with one of the projects I'm working on right now.
I wrote a small program that reads a text file (which has 8 columns of
data), coverting the time column (from a value like "13:04"
to "1304") and dumps that to a variable called $time.

The problem I'm having is that I want to take that information (stored
in $time) and pipe that to awk. The tests I've tried echo the
information from $time just fine, but they don't take that and pipe it
to awk. I've read the FAQ and the
Camel book, and it looks like I might need to use a pipe/fork
combination. The system() call doesn't seem to work for this
example.

Can anyone help with this one?

Here's a copy of what I've written so far:

--
#!/home/tclaydon/perl -w

$ENV{TERM}="vt100";
$basedir = "/home/tclaydon/tsscan/";
$tslist = $basedir . "test";

open(TS, $tslist);
   while ($data = <TS>) {
   chop($data);
   $_ = $data;
   s/://g;
   $time = $_;
   print "$time\n";
}

--

= TC





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

Date: Sun, 19 Apr 1998 19:01:25 +1000
From: Mark Constable <markc@renta.net>
Subject: Re: Project question and gripe about (Re: Snobby news group)
Message-Id: <3539BD65.CB552E3E@renta.net>

Tim Kramer wrote:
> 
> Question:  Has anyone tried playing with the netscape
> source code (to include any perl interface/mod)?

Also interested to know if anyone is contemplating
embedding a perl interpreter in mozilla ?

> I R A Aggie wrote:
> > If they're not willing to put in some effort to figure out their
> > problems, then why should anyone else be expected to put in
> > any more effort than what the questioner has already expended?
> ....

> Suggested rule of thumb:  If the question is below your
> ability, ignore it and let someone else respond to it.  (That
> is, unless someone is paying you to respond to ALL of
> the posts in c.l.p.m.)

Totally agree. I cannot believe some of these people here
have got the hide to reply to some newbies plea for help
with some antagonistic "get a clue" type post... without
directly offering any help !!

To me that is far far worse than any dumb newbie posting
a question about the most basic perl gotchas. If there is
anything that makes *me* mad (FWIW) it those dicks that have
got nothing better to say than RTFM.

--
Mark Constable  +61(0)755275724


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

Date: Sat, 18 Apr 1998 22:30:32 -0700
From: "Xah" <xah@best.com>
Subject: Q: ways to get text file content
Message-Id: <6hc1rf$2ip$1@nntp2.ba.best.com>

What's an efficient way to write a function that takes in a file path and
returns its contents as a string?

Here's how I'm doing it now:

----------------
#!perl -w
#MacPerl

use strict;

sub getFile {
 my($filePath) = $_[0];

 my($line)='';
 my($result)='';
 if (not(open(FILE,"<$filePath"))) {die "Sorrow: $!";};
 while (defined($line = <FILE>)) {
  $result .= $line;
 };
 if (not(close(FILE))) {die "Perl sucks because: $!";};
 return $result
};

print
(getFile('user347:T2:Perl_files_dir:perl_scripts_dir:temporaryPad.pl'));

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

My second question is: does the execution time of .= depends on the string
length?

Thanks for help.

 Xah
 xah@best.com
 http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
 Mountain View, CA, USA


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

Date: 19 Apr 1998 08:03:50 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Q: ways to get text file content
Message-Id: <6hcb56$7pi$2@marina.cinenet.net>

Xah (xah@best.com) wrote:
: What's an efficient way to write a function that takes in a file path and
: returns its contents as a string?
: 
: Here's how I'm doing it now:

Your code has all the signs of someone quite good at C coming to Perl -- 
you've solved the problem, but failed to 'think in Perl'.  First, some 
critiques of the details of your approach:

: sub getFile {
:  my($filePath) = $_[0];
:  my($line)='';
:  my($result)='';

No need for those parens on 'my' variable names.

:  if (not(open(FILE,"<$filePath"))) {die "Sorrow: $!";};

The idiomatic Perl way to write this is

  open(FILE, "< $filePath") or die "Sorrow: $!";

:  while (defined($line = <FILE>)) {
:   $result .= $line;
:  };

Similarly, you can express this as

  $result .= $line while defined ($line = <FILE>);

which some find a bit easier to parse by eyeball...once you get used to 
the style.

:  if (not(close(FILE))) {die "Perl sucks because: $!";};

  close(FILE) or die "Perl sucks because: $!";

(Love your error messages, by the way.)

:  return $result
: };
: 
: print
: (getFile('user347:T2:Perl_files_dir:perl_scripts_dir:temporaryPad.pl'));

Outermost parens aren't needed.

Now, here's how I'd rewrite your subroutine using your technique:

  sub getFile {
    my $path     = shift;
    my $contents = '';
    open(FILE, "< $path") or die "Can't open $path: $!";
    $contents .= $_ while <FILE>;
    close(FILE) or die "Can't close $path: $!";
    return $contents;
  }

And here's how I'd write it using the special $/ variable to go into 
'whole-file read mode':

  sub getFile {
    my $path = shift;
    local $/ = undef;
    open(FILE, "< $path") or die $!;
    my $contents = <FILE>;
    close(FILE) or die $!;
    return $contents;
  }

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sat, 18 Apr 1998 21:27:56 -0800
From: ~arthur <star@sonic.net>
Subject: Re: shorten array
Message-Id: <35398B5A.4712@sonic.net>

John,

It was I who asked and it is I that forgives----- no I do not forgive
only thank thank thank!!!!!!!!

~arthur

johnnie@NOPERSONALMAIL.edu wrote:
> 
> John Blanco <johnnie@holly.colostate.edu> bravely wrote:
> : ~arthur wrote:
> 
> : @words = ('lets', 'go', 'mets');
> 
> : srand;
> : while(@words) {
> :    $random_word = splice(@words, rand $#words, 1);
> :    print "$random_word\n";
> : }
> 
>    Whooops!  Got my languages mixed up! :)  rand returns 0 .. $arg-1.  So
> fix the above code by changing (rand $#words) to (rand scalar(@words))
> Sorry! :)
> 
>    - Johnnie B
> --
>    - Johnnie Blanco Jr.
>    - The Kilauea Caldera @ http://holly.colostate.edu/~johnnie
>    - "You always seem to find my faults; faster than you find your own."
>    -    Tori Amos [Upside Down]


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

Date: Sun, 19 Apr 1998 18:49:37 +1000
From: Mark Constable <markc@renta.net>
Subject: Re: Snobby news group
Message-Id: <3539BAA1.71028B90@renta.net>

I R A Aggie wrote:

> You're mistaken. Badly.
> 
> The attitude is more accurately stated as "you won't use the index
> in a book, you won't search the on-line documentation, you won't
> use 'perldoc perlfaq' but instead depend upon some kind-natured
> soul on Usenet to answer your question that is answered in the
> afore mentioned resources? then you get what you deserve."
> 
> If they're not willing to put in some effort to figure out their
> problems, then why should anyone else be expected to put in
> any more effort than what the questioner has already expended?

Simply because it is not possible for any _NEW_ user to perl
et al to read every fucking piece of documentation and literature
all on the first day... that is why. I have spent hours tracking
down problems, that were NOT explained clearly, in said documentation
and it is infuriating when you know that someone else who has
been down this track before would (most likely) know the answer
in 1 second, or less.

I would suggest it more appropriate for the right royal dicks
that know it all to go elsewhere from a general newsgroup where
most people would expect to be able to get some help and find
some support.

--
Mark Constable  +61(0)755275724


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

Date: Sat, 18 Apr 1998 14:57:42 +0200
From: "Reni Tschannen" <r.tsch@gmx.net>
Subject: Sorting Arrays to Numbers
Message-Id: <3538a403.0@news.limmat.ch>

I have an array as a result of an evaluation of a protocol-file on the
server. It's a list how often a jpg was chosen. It looks like this:

print @jpg;

Bach.jpg=50
Berg3.jpg=23
Dachs.jpg=76
Erde.jpg=102
etc.

Now I want to sort this list after the numbers and not the names. I've tried
this with:

foreach(@jpg) {
    ($jpg , $number) = split(/=/,$_);
    chomp($number);
    push(@jpg_new, "$number=$jpg\n");
    }
@jpg_new = sort($jpg_new);

print @jpg_new;

print out the new array shows this:

102=Erde.jpg
23=Berg3.jpg
50=Bach.jpg
76=Dachs.jpg

 ... so it's evident it's not sorted to the arithmetical values of the
numbers. What I want is a descending order in this format:

Erde.jpg=102
Dachs.jpg=76
Bach.jpg=50
Berg3.jpg=23

How can I achieve this? Please can a more advanced programmer help me with
this? There must be another way to solve this I suppose  as a newbie ... but
I'm stuck! Any hints are welcome ... thanks in advance!

Rene
--
http://www.octave2.ch







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

Date: 19 Apr 1998 08:40:20 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Sorting Arrays to Numbers
Message-Id: <6hcd9k$7pi$3@marina.cinenet.net>

Reni Tschannen (r.tsch@gmx.net) wrote:
: I have an array as a result of an evaluation of a protocol-file on the
: server. It's a list how often a jpg was chosen. It looks like this:
:
: print @jpg;
: 
: Bach.jpg=50
: Berg3.jpg=23
: Dachs.jpg=76
: Erde.jpg=102
: 
: Now I want to sort this list after the numbers and not the names. I've tried
: this with:
[snip]
: @jpg_new = sort($jpg_new);

sort() sorts lexically (alphabetically) by default, which is what you're 
seeing.  Do

  @jpg_new = sort { $a <=> $b } @jpg_new;

and it will sort numerically.

: ... so it's evident it's not sorted to the arithmetical values of the
: numbers. What I want is a descending order in this format:
: 
: Erde.jpg=102
: Dachs.jpg=76
: Bach.jpg=50
: Berg3.jpg=23

What you want here is a Schwartzian Transform.  As a newbie, you may not 
'get' this immediately, but figuring this out will move you significantly 
toward Perl enlightenment.

  @jpg_new = map  { $_->[0] }
             sort { $a->[1] <=> $b->[1] }
             map  { [ $_, (/=(\d+)/, $1) ] }
             @jpgs;

Note that this goes directly from your unsorted jpgs list into the sorted 
version, all in one (complex) operation, and retaining exactly the 
original elements with formatting quirks intact.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sat, 18 Apr 1998 19:02:00 -1000
From: "William Shaffer" <wpshaf@gte.net>
Subject: Text box alignmnet
Message-Id: <6hc0e2$rj3$1@gte2.gte.net>

Hi

    Does any one know how to get text boxes to line up vertically?

    I want to have text boxes out from a *.cgi script (wwwboard) line up
vertivally. I've read "Learning Perl" (O'Rielly Press) from cover to cover
and haven't found the answer.

    Currently the text boxes align like this:
                                   _______________________________
Optional Link URL : |_______________________________|
                   _______________________________
Link Title : |_______________________________|
                                     _______________________________
Optional Image URL: |_______________________________|


  I want an out put similar to this below.

(Note: Variable font size in news group format doesn't allow alignment in
the figure. For all intensive purposes, these text boxes are aligned
vertically)
                                      _______________________________
Optional Link URL    : |_______________________________|
                                      _______________________________
Link Title                    : |_______________________________|
                                       _______________________________
Optional Image URL : |_______________________________|




    Thanks in advance, William Shaffer









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

Date: Sun, 19 Apr 1998 01:10:16 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: William Shaffer <wpshaf@gte.net>
Subject: Re: Text box alignmnet
Message-Id: <35398738.17FD@juicepigs.com>

William Shaffer wrote:
> 
> Hi
> 
>     Does any one know how to get text boxes to line up vertically?
> 
>     I want to have text boxes out from a *.cgi script (wwwboard) line up
> vertivally. I've read "Learning Perl" (O'Rielly Press) from cover to cover
> and haven't found the answer.

Perhaps because it has absolutely nothing to do with perl?

The answer is tables.

If you can't figure it out with that try:
	news:comp.infosystems.www.authoring.html

HTH
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 2362
**************************************

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