[6710] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 335 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 21 11:17:41 1997

Date: Mon, 21 Apr 97 08:00:39 -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           Mon, 21 Apr 1997     Volume: 8 Number: 335

Today's topics:
     .Masterbating Teen Girl teenmast.jpg opwiurpoiuwe@pqoiurewoiu.com
     2D matrices (John Nguyen)
     Re: 2D matrices <rra@stanford.edu>
     Re: a question on striping characters westc@novachem.com
     Re: Again - ? Can I make small modal window <minaret@sprynet.com>
     Re: Error message? (ALASTAIR AITKEN CLMS)
     Re: evaluating an expression (ALASTAIR AITKEN CLMS)
     Help!! Coverting a string of bits representing hex nume <masonj@erols.com>
     Re: Help!! Coverting a string of bits representing hex  (Steffen Beyer)
     Re: Help!! Coverting a string of bits representing hex  (Andrew M. Langmead)
     Re: Help!! Coverting a string of bits representing hex  (Mike Stok)
     increment hash not working (Geoffrey Hebert)
     List question! (Mir Farooq Ali)
     Re: MacPerl problems (Chris Nandor)
     Need CGI script to get email after user fills web form <bharat@antrix.com>
     Re: Ousterhout and Tcl lost the plot with latest paper <fellowsd.cs@man.ac.uk>
     Re: Ousterhout and Tcl lost the plot with latest paper (Kelly Murray)
     Re: Ousterhout's paper: well worth reading. (Kelly Murray)
     Re: package main forces special ordering? <mcampbel@tvmaster.turner.com>
     Re: Perl -e switch <dehon_olivier@jpmorgan.com>
     PERL Programmers...Need your opinions <bradenb@ibm.net>
     Re: print <<THIS_PART; won't work (Ken Ledbetter)
     Redirecting to URL (Niksun)
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Kelly Murray)
     Re: Setting value of environment variable QUERY_STRING (ALASTAIR AITKEN CLMS)
     Re: Things that work on $_ <mcampbel@tvmaster.turner.com>
     Re: Unix and ease of use  (WAS: Who makes more ...) <fbonnet@irisa.fr>
     unpacking a null corrupts loop iteration variables! (Michael N. Edmonson)
     Re: What does  ^=  assignment op. do?? (Bob Wilkinson)
     Re: What does  ^=  assignment op. do?? (Mike Stok)
     Re: What does ^= operator do?? (Bob Wilkinson)
     Re: Who will win?  Borland or Microsoft or Programmers? <hhowe@trgnet.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 20 Apr 1997 21:12:35 GMT
From: opwiurpoiuwe@pqoiurewoiu.com
Subject: .Masterbating Teen Girl teenmast.jpg
Message-Id: <5je0s3$d1r@argentina.earthlink.net>



Check out this site, it has tons of young teens fucking and sucking cock !!!


http://www.sexy-girls.com


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

Date: Mon, 21 Apr 97 02:35:00 GMT
From: jnguyen@leland.stanford.edu (John Nguyen)
Subject: 2D matrices
Message-Id: <5jejol$o6c$1@nntp.Stanford.EDU>

Hi, according to the Perl book, perl does not directly support 
multi-dimensional arrays.  I am interested in using 2D integer arrays in Perl 
and would like to see an example of how it is done.  Is there an example 
someone could post or refer me to? Thank you very much!

John Nguyen


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

Date: 20 Apr 1997 19:50:43 -0700
From: Russ Allbery <rra@stanford.edu>
To: jnguyen@leland.stanford.edu (John Nguyen)
Subject: Re: 2D matrices
Message-Id: <qumu3l184xo.fsf@cyclone.stanford.edu>

[ Posted and mailed. ]

John Nguyen <jnguyen@leland.stanford.edu> writes:

> Hi, according to the Perl book, perl does not directly support
> multi-dimensional arrays.

That's not entirely correct; Perl does directly support multi-dimensional
arrays, it just implements them with references.  (Larry Wall has gone on
record as saying that the "does not support" language isn't correct.)

> I am interested in using 2D integer arrays in Perl and would like to see
> an example of how it is done.  Is there an example someone could post or
> refer me to?

man perllol has a lot of details on precisely how this works, and more
general details are in man perldsc and man perlref.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Sun, 20 Apr 1997 19:02:59 -0600
From: westc@novachem.com
Subject: Re: a question on striping characters
Message-Id: <335ABCC3.2DA5@novachem.com>

spanky@direct.ca wrote:
> 
> Hi,
> 
> how can you strip the character string, Ex ->  "I_LIKE_THE_NUMBER_9"
> to get just the number 9?
> 
> Thank you for your time.
> 
> Rob.tr\0-9\ \c;
will translate everything not a number to a blank.


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

Date: 21 Apr 1997 14:29:29 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: Again - ? Can I make small modal window
Message-Id: <01bc4e60$45742dc0$b2ebaec7@cactus>


> What I want to do is bring up a small modal window in the user's web
> browser, when they click on a link to enter a chat room. In it, I want
> to prompt for & collect a user name, and a room password. 
> 
> I know how to do this with a form. It's the small modal window, that I
> don't know how to do. I've seen this done at the following website, and
> it seems they are using a perl script (valuser.pl) to do it.  Or is
> their perl program probably embedding javascript to make the dialog box?

You will need to use JavaScript.

-- 
Geoff Mottram
minaret@sprynet.com


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

Date: 21 Apr 1997 12:36:16 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: Error message?
Message-Id: <5jfn00$i2h@epsilon.qmw.ac.uk>

In article <33595A4B.20EB@oakweb.com>, Korey <korey@oakweb.com> writes:
>Keep getting server error 500
>Message: CGI output from c:/servers/tsireps/cgi-shl/hello.pl contained
>no
>blank line separating header and data (most likely a broken CGI program)

Sounds like a standard CGI problem.  You must send a "Content type" header to
the browser before the data and this line must be followed by two carriage
returns:

print "Content-type: test/html\n\n";

That's the perl version of this procedure - for a browser via a server.

Alastair.


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

Date: 21 Apr 1997 12:46:44 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: evaluating an expression
Message-Id: <5jfnjk$i2h@epsilon.qmw.ac.uk>

In article <01bc4de2$1488f980$c8e433cf@marvin>, "Stephan Nagy" <steph@ciris.net> writes:
>There is probably a simple solution to this, but i can't figure it out.
>how do i evaluate an expression to see if it is divisible by a number. or
>in other words.
>
>if ( (sumnumber/4) == a whole number) {
>	@DaysInMonth=31,29,31,30,31,30,31,31,30,31,30,31
>}
>elsif ((sumnumber/4) != a whole number) {
>	@DaysInMonth=31,28,31,30,31,30,31,31,30,31,30,31
>}

Leap years, huh :-).  % is the modulus operator:

if ( $year%4 > 0 ) {
    print "this is a leap year\n";
} else {
    print "this is not a leap year\n";
}

For further info see the perlop manpage.

Alastair.


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

Date: Sun, 20 Apr 1997 22:46:10 +0500
From: "John Mason Jr." <masonj@erols.com>
Subject: Help!! Coverting a string of bits representing hex numerals to long integer
Message-Id: <335A5662.64EB@erols.com>


Hi,

I am new to this so this may be something I am overlooking .

I start with a string representing 24 bits of data
000000000000001011100011

This data represents 6 groups of 4 bits of data each representing a 
hexidecimal numbers.

0000	0000	0000	0010	1110	0011
   0	   0	   0	   2       d	   3

The end result I need in long integer is 

(0 x 16^5)+(0 x 16^4)+(0 x 16^3)+(2x 16^2)+(d^16^1)+(3 x 16^0)

I have used substr to get the 4 bit groups correctly but I don't know how 
to take it from there.

 Thanks in advance
John Mason Jr.


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

Date: 21 Apr 1997 08:07:21 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Help!! Coverting a string of bits representing hex numerals to long integer
Message-Id: <5jf77p$s2$1@en1.engelschall.com>

John Mason Jr. <masonj@erols.com> wrote:

> Hi,

> I am new to this so this may be something I am overlooking .

> I start with a string representing 24 bits of data
> 000000000000001011100011

> This data represents 6 groups of 4 bits of data each representing a 
> hexidecimal numbers.

> 0000	0000	0000	0010	1110	0011
>    0	   0	   0	   2       d	   3

> The end result I need in long integer is 

> (0 x 16^5)+(0 x 16^4)+(0 x 16^3)+(2x 16^2)+(d^16^1)+(3 x 16^0)

> I have used substr to get the 4 bit groups correctly but I don't know how 
> to take it from there.

>  Thanks in advance
> John Mason Jr.

Use "unpack"!

See the man pages (man perlfunc, I think).

Yours,
-- 
    |s  |d &|m  |    Steffen Beyer <sb@sdm.de> (+49 89) 63812-244 fax -150
    |   |   |   |    software design & management GmbH & Co. KG
    |   |   |   |    Thomas-Dehler-Str. 27, 81737 Munich, Germany.
                     "There is enough for the need of everyone in this world,
                     but not for the greed of everyone." - Mahatma Gandhi


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

Date: Mon, 21 Apr 1997 14:05:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Help!! Coverting a string of bits representing hex numerals to long integer
Message-Id: <E8zr4p.DKB@world.std.com>

"John Mason Jr." <masonj@erols.com> writes:

>I start with a string representing 24 bits of data
>000000000000001011100011

>This data represents 6 groups of 4 bits of data each representing a 
>hexidecimal numbers.

>0000	0000	0000	0010	1110	0011
>   0	   0	   0	   2       d	   3

>The end result I need in long integer is 

>(0 x 16^5)+(0 x 16^4)+(0 x 16^3)+(2x 16^2)+(d^16^1)+(3 x 16^0)

One thing that you seem missing is the fact that hexadecimal numbers
are just a notational convenience, they is no separate representation
for them in the computer. (The computer only sees numbers as
binary. The programmer or user can choose to read them or write them
in hexadecimal, decimal, or whatever. This only changes the external
representation, not the number itself.)

So, your problem isn't turning a string of bits into a hex integer, it
is trying to turn a string of bits into an integer, which if you
choose, you may display as hex.

Take a look at the pack and unpack functions. There are a couple of
things that may not happen like you expect, though. The end result of
what you want is:

$bitstring = '000000000000001011100011';
$number = unpack 'I', pack 'B32', '0' x (32 - length $bitstring) . $bitstring;

That is:

1. Pad the bitstring to a long integer in size.
2. Pack the bitstring into a scalar, (The result is a string
"\x0\x0\x0\x0\x0\x2\xe\x3")
3. Unpack the packed scalar into a perl numeric scalar (0x02e3)
-- 
Andrew Langmead


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

Date: 21 Apr 1997 14:18:26 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Help!! Coverting a string of bits representing hex numerals to long integer
Message-Id: <5jfsvi$d1c@news-central.tiac.net>

In article <335A5662.64EB@erols.com>, John Mason Jr. <masonj@erols.com> wrote:
>
>Hi,
>
>I am new to this so this may be something I am overlooking .
>
>I start with a string representing 24 bits of data
>000000000000001011100011
>
>This data represents 6 groups of 4 bits of data each representing a 
>hexidecimal numbers.
>
>0000	0000	0000	0010	1110	0011
>   0	   0	   0	   2       d	   3
>
>The end result I need in long integer is 
>
>(0 x 16^5)+(0 x 16^4)+(0 x 16^3)+(2x 16^2)+(d^16^1)+(3 x 16^0)

You can use pack and unpack, but remember to pad the string out to 32
bits.  For example

printf "%06x", unpack 'N', pack 'B32', '00000000' . '000000000000001011100011'

says 0002e3 on my system.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 21 Apr 1997 03:41:45 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: increment hash not working
Message-Id: <5jemkq$pui$1@news3.microserve.net>

I must be missing something simple. 
My +1 below works first time but not second.
OK it is my first time with this, but I thought I
was following the rules.

while (<SCORE>) {
   chomp;
  ($Cdiv, $dt, $hteam, $scoreh, $ateam, $scorea) = split(/:/,$_,6);
   # add 1 to games played for home team
   $play{$hteam} = $play{$hteam} + 1;  
   if ($play{$hteam}=1){    ## second time through this still = 1
       $win{$hteam}=0;
       $lose{$hteam}=0;
       $draw{$hteam}=0;
    }  # end if
}  # end when

email please soccer@microserve.net
Check out the Perl site!

http://www.microserve.net/~soccer/

use password perlmisc

Geat tool for Developers>



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

Date: 21 Apr 1997 04:44:52 GMT
From: mfali@cs.vt.edu (Mir Farooq Ali)
Subject: List question!
Message-Id: <5jerc4$3hh@server.cs.vt.edu>

Hello! If I've got a list called something like @list. I want to read
line by line a large amount of data. Then I want to add one particular
field from each of the lines, call it $field, to this list. I want only
unique elements to be added to the list. This means that once the loop
ends, the @list should consist of only unique elements. 

Any help will be appreciated. Please reply directly by email since I do
not visit this newsgroup often.

Thanks,

-Farooq.


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

Date: Mon, 21 Apr 1997 09:34:08 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: MacPerl problems
Message-Id: <pudge-ya02408000R2104970934080001@nntp.noc.netcom.com>

In article <binoni-2004972002150001@dialup70-5-11.swipnet.se>,
binoni@mbox318.swipnet.se (binoni) wrote:

#1. I cannot get the help function to work, even though my Internet Config
#is correctly configured as per the instructions in the README.MAC.
#Everytime I choose some item in the help listing that calls for something
#in the pod folder, MacPerl wants to launch the Internet Config app.

It really sounds like you do NOT have Internet Config configured properly. 
You should have IC 1.2 or 1.3, and you should have the Helper "pod"
assigned to "Shuck."  Hope that helps.


#2. A more serious one. When I try to compile (or build or whatever) a pm
#file with the Makefile.pl file, MacPerl crashes the computor with an Error
#Type 11. The last message that MacPerl gives is:
#   File 'MacHD:Programs:Macperl f:lib:ExtUtils:MM_MacOS.pm; Line 281
#and then the whole thing dies. I've tried to make the same thing without
#using any extensions, but exactly the same thing happens.

You cannot run Makefiles under MacPerl (in general).  Instead, try simply
putting the pm files in the right place in your directory tree.

Also, a better place for MacPerl info is the MacPerl mailing list (see the
MacPerl FAQ).

        http://www.industrialstrengthsw.sk.ca/MacPerl/MacPerlFAQ.html

#================================================================
I am not authorized to fire substitute teachers.

   --Bart Simpson

Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: 21 Apr 1997 04:18:06 GMT
From: "Bharat Kurani" <bharat@antrix.com>
Subject: Need CGI script to get email after user fills web form
Message-Id: <01bc4e0b$108527e0$9d5f56ce@antrix.vip.best.com>

I need CGI script to get email after user fills my web form
once he fills in my web site form.

Thanks
bharat@antrix.com


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

Date: 21 Apr 1997 11:33:50 GMT
From: Donal K. Fellows <fellowsd.cs@man.ac.uk>
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <5jfjau$r27@m1.cs.man.ac.uk>

In article <joswig-ya023180000804970632340001@news.lavielle.com>,
Rainer Joswig <joswig@lavielle.com> wrote:
> In article <5ic0qc$ene@psychotix.cs.uoregon.edu>, jhobbs@cs.uoregon.edu
> (Jeffrey Hobbs) wrote: 
>> In article <5ibl1p$5et$2@csnews.cs.colorado.edu>,
>> Tom Christiansen  <tchrist@mox.perl.com> wrote:
>>>    fellowsd@cs.man.ac.uk (Donal K. Fellows) writes:
>>>>  toplevel .t
>>>>  button .t.b -text Hi! -font {Times 16} -command {puts "Pressed at (%x,%y)"}
>>>>  pack .t.b -fill both -expand 1
>>>>
>>>> How much extra Lisp would be needed to achieve this?
> 
> This depends on the GUI toolkit you would use and has nothing
> to do with Lisp.

I'm particularly interested in how the "command" callback is handled,
and especially how the Lisp-like language specifies what information
from the event is passed to the callback, and in what order.

Hmm.  I just spotted a bug in my code (which nobody pointed out... :^)
and I would like to change from using a button to a label (with no
default event bindings):

    toplevel .t
    label .t.msg -text Hi! -font {Times 16}
    frame .t.band -height 20 -width 10 -bg red
    pack .t.msg .t.band
    bind .t <ButtonPress-1> {puts stdout "Pressed %W at (%x,%y)"}

The only line I'm really interested in is the binding line (the others
merely set the stage, and I have seen reasonable transcriptions in
other languages)

>> Yes and no.  Some of the discussion has wandered off the main thrust of JO's
>> paper, but Donal's point here is LOC (or perhaps more generally syntactic
>> simplicity).  The use of Tk here proves a point because Tk has been grafted
>> onto so many other languages.  The example above is written most "plainly"
>> (concisely / fewest chars with greatest clarity / ...) when written in Tcl.
> 
> Is "fewer chars" is a meaningful criteria for software quality?

Not in and of itself, but I'd add that failing to add needless
verbosity is probably a good thing (of course, the key is in the word
"needless" :^)

> I'd rather prefer readability and fewer implicit assumptions.

I can definitely think of cases where these do not go together, and
where the application of either actually worsens quality (a truly
frightening thought, admittedly).  As always, correct design takes
thought and planning...

> I'd also prefer layout in declarative formats. etc. etc.

I can't rebut this, as I don't understand your meaning well enough!

Donal.
--
Donal K. Fellows   http://r8h.cs.man.ac.uk:8000/  (SAY NO TO COMMERCIAL SPAMS!)
(work) fellowsd@cs.man.ac.uk     Dept. Comp. Sci, Univ. Manchester, U.K.
 |     donal@ugglan.demon.co.uk  6,Randall Place, Heaton, Bradford, U.K. (home)
 +-> ++44-161-275-6137  Send correspondence to my office  ++44-1274-401017 <-+


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

Date: 21 Apr 1997 03:02:41 GMT
From: kem@math.ufl.edu (Kelly Murray)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <5jelch$5dd$1@sparky.franz.com>

In article <s6yn2qxkwix.fsf@aalh02.alcatel.com.au>, Chris.Bitmead@alcatel.com.au (Chris Bitmead uid(x22068)) writes:
>> 
>> The only benefit you claim for Tcl that doesn't also apply to scheme
>> is #3. You would like to type...
>> 
>> func arg1 arg2
>> instead of
>> (func arg2 arg2)
>> 
>> Ok, a minor but perhaps valid point if you want dumb users to use it
>> like a shell.
>> 

There are many "top level" Lisp interfaces that accept "func arg1 arg2"
in place of (func arg2 arg2), and do completion of the function names
and can prompt for their arguments BY NAME as well.
Common Lisp also has :keyword arguments, which these "top level" interfaces
can also do completion on.  For example, the function open() takes a
pathname and keyword arguments :direction :element-type :if-exists.

Furthermore, in some window based systems, any object visible on a window
will be mouse senstive in this prompting context, 
and can be "clicked" on to supply the arguments to the function,
and in some cases, it can restrict the items which are highlighted to
be only those of the appropriate type to the function!  

You can't tell me that isn't a high-level command interface.

That is the power that Lisp gives to the "environment"

-kelly murray   kem@franz.com  http://www.franz.com








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

Date: 21 Apr 1997 03:34:20 GMT
From: kem@math.ufl.edu (Kelly Murray)
Subject: Re: Ousterhout's paper: well worth reading.
Message-Id: <5jen7s$5nb$2@sparky.franz.com>

> wilson@cs.utexas.edu (Paul Wilson):
> Often the reason that Tcl seems like the right language for the job,
> even one it's not designed for, is just that C is the wrong language
> for the job.  

Excellent Observation.   That pretty much sums up this whole
Ousterhout's paper/TCL/Script/System topic!  

-Kelly Murray   kem@franz.com

P.S.  Don't get me wrong, C is a great language! ...for implementing UNIX.






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

Date: 21 Apr 1997 09:40:49 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: package main forces special ordering?
Message-Id: <r5n2qsmr32.fsf@tvmaster.turner.com>

stephen farrell <sfarrell@phaedrus.uchicago.edu> writes:


> > Please get used to using the uglier ...

to whom?

> > and less ambiguous 

to perl?  Or you?


> where does 
> 
> 	$fcs = new Fcs();
> 
> fall?

Was wondering that myself.


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

Date: 21 Apr 1997 15:16:33 +0100
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: Re: Perl -e switch
Message-Id: <njzd8robgvy.fsf@jpmorgan.com>

Chris Andrew <earl@bell.us> writes:

> Ex: I have an array in the shell
> arr="4567 2351 7902 6721 1267"
> which I want to sort. From shellscript arr.com I do a call:
> 
> arr.perl "$arr"
> 
> to perl script arr.perl where I have:
> 
> print join (' ', sort split(' ', $ARGV[0])), "\n";
> 
> This returns the correct answer:
> 
> 1267 2351 4567 6721 7902.
> 
> Fine. 
> Now I want to move the perl statement to the shell script in a "sort-of" 
> here-statement as follows:
> 
> perl -e `print join (' ', sort split(' ', $ARGV[0])), "\n";' "$arr"
> 
> or, just for a try
> 
> perl -e 'print join (' ', sort split(' ', $arr)), "\n";'
> 
> *None* work, they give syntax error, whereas
> 
> perl -e 'print $ARGV[0], "\n";' "$arr"
> 
> works fine (returning the unsorted array).
> 
> Any clues?

I can see many potential sources of errors in what you are doing:

 perl -e 'print join (' ', sort split(' ', $arr)), "\n";'
                      ^
The quote closes the perl expression.
In the shells I know, $arr is not interpolated within single quotes.
Perl arrays are different from shell arrays.

I suggest:

perl -e "@perl_arr = sort qw/${arr}/;" \
     -e 'print join(" ", @perl_arr);'

Hope this helps.

Olivier Dehon.


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

Date: 21 Apr 97 14:30:15 GMT
From: "Jerry Bradenbaugh" <bradenb@ibm.net>
Subject: PERL Programmers...Need your opinions
Message-Id: <01bc4e60$d6bf00c0$7ac32581@jkb>

I am a technical writer and web developer. I use PERL in both the web sites
I maintain. I enjoy PERL so much, I am going to seek work as a PERL
programmer.

As PERL programmers, please tell me what types of programs you write and
anything else helpful to know in becoming a PERL programmer.

Thank You.

Jerry Bradenbaugh
HotSyte Webmaster
http://www.serve.com/hotsyte
HotSyte- The Connection to that which is JavaScript
bradenb@ibm.net


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

Date: Mon, 21 Apr 1997 13:12:30 GMT
From: ledheadx@mindspring.com (Ken Ledbetter)
Subject: Re: print <<THIS_PART; won't work
Message-Id: <335b6775.762377@news.mindspring.com>

On 20 Apr 1997 17:49:51 -0700, mike@paranoid.delusion.org (Mike)
wrote:
>In article <335a9469.10358379@news.mindspring.com>,
>Ken Ledbetter <ledheadx@mindspring.com> wrote:
>>
>>I'm trying to do something like this
>>
>>print <<STOP;
>>
>>   <html><body>
>>   HI
>>   </body></html>
>>STOP
>>
>>but it won't work, any help?
>
>What error are you getting upon exectution?  Any whitespace after
>STOP?
>
>+m

I'm getting an error 500, malformed header.  I'm sure there is no
white space after STOP and I tried to use:

print <<'STOP';

also.  Any other ideas?


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

Date: Mon, 21 Apr 1997 05:10:54 GMT
From: niksun@lconn.net (Niksun)
Subject: Redirecting to URL
Message-Id: <335af600.41865466@news.inetw.net>

I know the format to direct the user to a URL in Perl is:

	print "Location: xxxxxxx.com\n";

But, let's say I have already printed some text in the browser window:

	print "Content-type: text/html\n\n";
	print "blahblahblah\n";

How can I direct the user to a URL after doing this?  I tried the same
command as my first example, but it simply prints this in the browser
window instead of redirecting the user (because I already set the MIME
type to text/html).  Any ideas?  Please e-mail me.

Niksun
niksun@lconn.net


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

Date: 21 Apr 1997 03:22:38 GMT
From: kem@math.ufl.edu (Kelly Murray)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <5jemhu$5nb$1@sparky.franz.com>

>clin@cs.umd.edu (Charles Lin):
>>Erik Naggum (erik@naggum.no) wrote:
>>|| strings are excellent for external representation, and that's where they
>     This was the point.   Now, perhaps I completely misunderstood 
>what Ousterhout did, but I was under the impression that he said
>everything in Tcl (the external representation) is a string.  

Why not make everything a stream of BYTES ?  
Then we can send one programs output BYTES as input BYTES to another program!
It works, you can do a lot of stuff with it -- 
been around now for 20-30 years.  Has a few bugs though.  BYTE number 4 causes
some confusion.  BYTE number 0 too.  BYTE numbers > 127 seem to cause some
bugs too.  Nothing that can't be found and fixed after 20 years of testing.

Hmm, maybe if everything was an OBJECT instead, we might get somewhere??

Just a thought.

-Kelly Murray  kem@franz.com  http://www.franz.com


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

Date: 21 Apr 1997 11:39:30 GMT
From: zpalastair@unl.ac.uk (ALASTAIR AITKEN CLMS)
Subject: Re: Setting value of environment variable QUERY_STRING
Message-Id: <5jfjli$fp8@epsilon.qmw.ac.uk>

In article <Pine.OSF.3.93.970419144515.10730A-100000@sparrow.qut.edu.au>, THIAM YEO <n1835173@sparrow.qut.edu.au> writes:
>  IS it possible for me to set the value of QUERY_STRING from a Perl
>script such that another script will be able to pick up that value?
>
>  And, how do I pass a value from a Perl script to another Perl script?

These are essentially the same question.  In both cases you want to pass a
scalar (string in this case) from one script to another:

Do you want a return calue from the call?  This would do it.

$return_val = `other.pl $ENV{'QUERY_STRING'}`;

other.pl must look for ARGV[1] which is the paramameter in the calling
command but it can just as easily find $ENV{'QUERY_STRING'} (or anything else
in %ENV), because other.pl inherits the parent's environment when it is called.

Alastair.


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

Date: 21 Apr 1997 09:56:32 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: Things that work on $_
Message-Id: <r5hgh0mqcv.fsf@tvmaster.turner.com>

searlea@aston.ac.uk (ash) writes:


> Maybe it's some perverse idea, but I like the possiblity of writing
> a 'reasonable size' program with NO variable names...
> 
> (I have no idea what a 'reasonable size' would be.  Probably smaller that
> something that makes my brain bleed...)

This has been done in glorious detail in the various obfuscated code
contests and such.  I think www.perl.org (not .com) has a section for
such things, but I could be mistaken on that.


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

Date: Mon, 21 Apr 1997 15:34:11 +0200
From: Frederic BONNET <fbonnet@irisa.fr>
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <335B6CD3.3E4E@irisa.fr>

[misc.jobs.misc,comp.lang.basic.visual,comp.databases,
comp.infosystems.www.advocacy and comp.sys deleted from the Xpost list]

Hi all,

Tim Behrendsen wrote:
> 
> Justin Hickey <jhickey@hpcc.nectec.or.th> wrote in article
> <334DC78C.167E@hpcc.nectec.or.th>...
> > How about X Windows? It has been accepted by all UNIX vendors as their
> > windowing system (nothing else has challenged it that I know of ie I'm
> > talking strictly UNIX here), and I may be wrong and feel free to correct
> > me, but I do believe that it is free software. And it certainly is
> > significant in size and complexity IMHO.
> 
> Well, a couple points about this (and this is a good example of
> sufficient complexity)...
> 
> 1) The X11 protocol is actually pretty good, but that's a design spec,
>    not really code.  The sample X server code is crap, and is almost
>    always enhanced by vendors.
> 
> 2) Xt is complete inefficient, slow, buggy, confused, badly designed
>    crap.
> 
> 3) Motif is semi-commercial, IOW it has to be licensed from OSF.
>    In any case, yes -- before you all start with me -- Motif has
>    some nice features that aren't found elsewhere, but it is
>    primarily dominant with Unix for the simple reason that there
>    isn't anything else.  It is far inferior to most of the other
>    commercial Window systems, and in fact, many thought it was
>    inferior to OpenLook.  Don't even mention CDE.

Let me remind you that this message is being cross-posted on
comp.lang.tcl, dedicated to the Tcl language but also to the Tk toolkit.
IMHO Tk is a very viable alternative to Motif:

  - it's far less bloated IMHO
  - its faster AFAIK
  - it's free (GPL-style)
  - its code is crystal-clear and very well commented
  - it's portable (official version supports Windows, MacOS, Unix/X, and
    there are ports to OS/2, AmigaDOS, VMS...)
  - it's easy to use
  - it can be (and is being) used seamlessly with C, Tcl, Perl, Python,
    LUA, Limbo (Inferno's system programming language), and Java (Ioi
    Liam is working on a Tcl/Tk port to Java called JaCL).
  - it's being used in many free/commercial products (some are very
    successful).
  - etc.

Motif is widely used in the industry partly because it's commercial
(most project leaders won't even think about using a free product, for
political/licence reasons) and IMHO because marketroids only use
"mainstream" and "industry standard" products even when a better
alternative exists. Look at Windows, Word...

There's also Athena Widgets, which works fine. If you think it looks
ugly, you can replace it with Motif/NeXT/Windows-looking versions, or
Xaw-XPM if you have plenty of memory and a good gfx card (it replaces
every element with a pixmap. Looks great, but damn slow).
Not for the feeble, there's also AWT (ROTFL!)...

So now, you know there are alternatives to Motif.

CUl8r, Fred
-- 
Frederic BONNET		                                fbonnet@irisa.fr
 Ingenieur Ecole des Mines de Nantes/Ecole des Mines de Nantes Engineer
        IRISA Rennes, France - Projet Solidor/Solidor Project
------------------------------------------------------------------------
  Tcl: can't leave     | "Il ne faut jamais remettre au lendemain ce
$env(HOME) without it! | qu'on peut faire le surlendemain" (Oscar WILDE)


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

Date: 21 Apr 1997 14:13:41 GMT
From: edmonson@chlccs.fccc.edu (Michael N. Edmonson)
Subject: unpacking a null corrupts loop iteration variables!
Message-Id: <5jfsml$msa$1@taurus.fccc.edu>


I was plagued by strange behavior in a Perl script, where the last
value in a loop iteration would come up as undef (ie, in "foreach
(1,2,3)", I would get "undef" instead of "3").  Finally tracked it
down to "unpack" -- it seems if you happen to try to "unpack" a null
value, the last entry in an iteration loop will be corrupted.  I've
seen this behavior in Perl 5.001 and 5.003, but happily it seems to be
fixed in the latest Perl 5.004 beta.  Just thought I'd post to maybe
save someone some debugging time.

This code demonstrates the bug:

#!/usr/bin/perl -w
#
#  unpacking from a null value blows up the last value of 
#  loop iteration variables! 
#
#  Michael Edmonson, mikeedmo@voicenet.com, mn_edmonson@fccc.edu
#
#  affects perl5 up to and including 5.003.
#  Fixed somewhere before 5.003_95.

use strict;
my %hash = (a => 1,
	    b => 1,
	    c => 1);

foreach (keys %hash) {
  unless (defined $_) {
    # this should never happen!
    print "Loop iteration variable undefined!!!\n";
    last;
  }
  printf "%s\n", $_;
  my $z = unpack 'N', "";
}

__END__




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

Date: Mon, 21 Apr 1997 13:54:37 +0100
From: bw@pindar.co.uk (Bob Wilkinson)
Subject: Re: What does  ^=  assignment op. do??
Message-Id: <bw-2104971354370001@ip57-york.pindar.co.uk>

In article <335B4B94.41C6@mrc-lmb.cam.ac.uk>, Jong
<jong@mrc-lmb.cam.ac.uk> wrote:

> Thanks a lot.
> 
> I could not get it in Perl book.
> 
> Cheers,
> 
> Jong
> 

$a ^= $b is equivalent to $a = $a ^ $b, where ^ is a bitwise XOR function.
If $a is (in binary), 11101100 and $b = 11001110 then after operation 
$a is 00100010 (exclusive OR - ie. OP bit set only if one of the two input bits
is set).

Bob

-- 
I have become death, destroyer of the worlds.


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

Date: 21 Apr 1997 14:01:47 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: What does  ^=  assignment op. do??
Message-Id: <5jfs0b$c38@news-central.tiac.net>

In article <335B4B94.41C6@mrc-lmb.cam.ac.uk>,
Jong  <jong@mrc-lmb.cam.ac.uk> wrote:
>Thanks a lot.
>
>I could not get it in Perl book.

It's the xor assignment operator e.g.

  DB<1> $a = 0x45

  DB<2> $a ^= 0xFA

  DB<3> printf "%x", $a
bf

and, ^ 01000101 
       11111010
       ========
       10111111

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 21 Apr 1997 13:51:36 +0100
From: bw@pindar.co.uk (Bob Wilkinson)
Subject: Re: What does ^= operator do??
Message-Id: <bw-2104971351360001@ip57-york.pindar.co.uk>

In article <335B4BEF.167E@mrc-lmb.cam.ac.uk>, Jong
<jong@mrc-lmb.cam.ac.uk> wrote:

> Thanks a lot,
> 
> Jong
> 
> 

Extrapolating from all other op= pseudo-ops I guess that 

$a ^= $b is equivalent to $a = $a ^ $b, where ^ is a bitwise XOR.

Bob

-- 
I have become death, destroyer of the worlds.


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

Date: Sun, 20 Apr 1997 21:13:34 -0500
From: Harold Howe <hhowe@trgnet.com>
Subject: Re: Who will win?  Borland or Microsoft or Programmers?
Message-Id: <335ACD4E.26C8@trgnet.com>

> >Use MS!  I've found that Borland sometimes comes short. Example:
> >Win32, Borland 4.52 - No inp or outp!  Oooops... No I/O  - Did we forget
> >something?  Ahhh well, just buy our 32bit Assembler ...
> >

You're missing the point. You're not supposed to do port I/O in win32.
This was Microsoft's idea, not Borland's. NT will boot your program out
the door if you try port I/O from a 32-bit program.

Harold Howe
hhowe@trgnet.com

PS- if you have tasm32.exe, just compile you're own inp and outp.
Borland provides the source for the RTL. Just copy the files over to
you're hard drive and compile them into a 32-bit OBJ.


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

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

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