[7072] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 697 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 2 20:17:22 1997

Date: Wed, 2 Jul 97 17:00:28 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 2 Jul 1997     Volume: 8 Number: 697

Today's topics:
     Re: @{} and wierd execution order <rootbeer@teleport.com>
     Re: @{} and wierd execution order (Charles DeRykus)
     Accessing Unix Modem ports via perl.  (Yes I checked De (Mark Bainter)
     Re: Accessing Unix Modem ports via perl.  (Yes I checke (Nathan V. Patwardhan)
     BSD-DB and tied hash problem ghent@bounty-hunters.com
     Re: Compression in Perl <igorv@styx.or.fedex.com>
     Content type messages in frame? <labah@algonet.se>
     Re: Error: Document Contains No Data <rootbeer@teleport.com>
     Re: exec perl script in html file (Tung-chiang Yang)
     Re: exec perl script in html file <rootbeer@teleport.com>
     Re: Finding users hostname <sibsib@hotmail.com>
     Re: Finding users hostname <rootbeer@teleport.com>
     Re: Help Please <rootbeer@teleport.com>
     Re: how define random integer? <rootbeer@teleport.com>
     Re: No output <rootbeer@teleport.com>
     Package for working with a MS network? (Marc Haber)
     Package to manipulate Windows 95 shortcuts (*.lnk)? (Marc Haber)
     Re: Package to manipulate Windows 95 shortcuts (*.lnk)? (Shelle)
     Re: Perl  on Linux (Nathan V. Patwardhan)
     print reverse (Zisha Weinstock)
     Re: print reverse <thuja@internauts.ca>
     Re: print reverse <rootbeer@teleport.com>
     Re: Require Problem xewj@odin.sunquest.com
     Re: system() calling GNUplot (CHAN TANG Eric-Aubert)
     Re: take linebreaks out of forms? <rootbeer@teleport.com>
     Trouble with Split command <nospam_sloscialo@chubb.com_nospam>
     Re: uc function for PERL4 <anthonyl@delphi.co.uk>
     What does this do? <schneide@storm.simpson.edu>
     Re: What does this do? (M. muPe)
     Re: When was PERL created? <sibsib@hotmail.com>
     Re: When was PERL created? (Kevin Zwack)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 2 Jul 1997 15:43:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "David W. Coppit" <dwc3q@mamba.cs.Virginia.EDU>
Subject: Re: @{} and wierd execution order
Message-Id: <Pine.GSO.3.96.970702153833.8392I-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, David W. Coppit wrote:

> sub returnarr {
>   return ("a","b","c");
> }
> 
> sub getsecond (\@) {
>   my $aref = shift;
>   return $aref->[1];
> }
> 
> print "getsecond (\@temp) results in: ";
> @temp = returnarr();
> print getsecond (@temp);
> print "\n";
> 
> print "getsecond (\@{returnarr()}) results in: ";
> print getsecond (@{returnarr()});                   # LINE 18
> print "\n";
> ------------ End code ------------
> 
> It seems like @{returnarr()} isn't being evaluated before getsecond is
> called. 

It may seem that way, but it ain't so. :-)  returnarr is being called in a
scalar context. It's returning the last element of that comma-separated
list ("c") which is then being used as a soft array reference (to @c). No
wonder you're getting an error!

I think you wanted to make "Line 18" look like this.

    print getsecond (@{ [returnarr()] });

Now, (reading from the inside out) you can call it in a list context, use
it to build an anonymous list, then pass that list as the array parameter
to getsecond. Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 2 Jul 1997 21:01:06 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: @{} and wierd execution order
Message-Id: <ECpMDv.CL8@bcstec.ca.boeing.com>

In article <Pine.SOL.3.96.970702112053.19999A-100000@mamba.cs.Virginia.EDU>,
David W. Coppit <dwc3q@mamba.cs.Virginia.EDU> wrote:
 > Hi all,
 >   The example program below is overly complicated, but it shows the
 > effect that I need. When I run the following, I get an error "Use of
 > uninitialized value at ./testing line 18".
 > 
 > ------------ Start code ------------
 > sub returnarr {
 >   return ("a","b","c");
 > }
 > 
 > sub getsecond (\@) {
 >   my $aref = shift;
 >   return $aref->[1];
 > }
 > 
 > print "getsecond (\@temp) results in: ";
 > @temp = returnarr();
 > print getsecond (@temp);
 > print "\n";
 > 
 > print "getsecond (\@{returnarr()}) results in: ";
 > print getsecond (@{returnarr()});                   # LINE 18
 > print "\n";
 > ------------ End code ------------
 > 
 > It seems like @{returnarr()} isn't being evaluated before getsecond is
 > called. In my "real" program there are other arguments to "getsecond" that
 > allow it to execute without error, and stepping through with the debugger
 > shows that "returnarr" is being executed *after* the print!
 > 
 > Can anyone shed some light on the semantic weirdness of @{}?
 > 

The problem is that the sub returnarr doesn't do what you 
hope: 

  return ("a","b","c");

This'll return "c" in a scalar context; the array itself in a
list context. 

You want an array reference rather than the array itself so
the following will do what you want:

return ["a","b","c"];   # or more easily: [qw/a b c/] 


HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: Wed, 02 Jul 1997 22:15:58 GMT
From: mark@michiana.net (Mark Bainter)
Subject: Accessing Unix Modem ports via perl.  (Yes I checked DejaNews)
Message-Id: <33bacbe6.456368423@news.michiana.net>

I also tried to check CPAN and the FAQ which I was unable to access.
I saw several people had asked this question, however, there were no
satisfactory answers.  (satisfactory being subjective of course :)
Some said to write a bourne shell script, others said thinks akin to
that (use a system command to run cu) and one said to use an interface
protocol using sendpage.  Well, none of these really fits well into
solving my problem.  So, I'm trying to access the modem.  I have a
_very_ simple version of what I want to do in a Korn shell script.
The perl script I'm writing is infinitely more complex.  The point
there being that I know the pager dial string I'm using works.  I have
written a very short script to try and dial my pager, just to get that
part working apart from the rest of the script:

__BEGIN_SCRIPT__

#!/usr/local/bin/perl5 -Tw                                           
                                                                     
use diagnostics;                                                     
use vars qw( $MODEM_PORT );                                          
                                                                     
&dial_pager;                                                         
                                                                     
sub dial_pager{                                                      
        $MODEM_PORT = "+>/dev/tty1A";                                
        open(MODEM_PORT) or die "Failed to open $MODEM_PORT : $!";

        print MODEM_PORT "atdt5551212,,,,,1234567";                
        close MODEM_PORT;                                            
        }                                                            


__END_SCRIPT__

The script executes ok (when run as root, of course) but then just
hangs.  The modem never dials.  I'm sure this is probably a poor way
of accomplishing my goal.  If anyone out there would like to educate
me on the proper ways of going about dialing a modem I am ready and
willing to learn. :)

Note:
	I was finally able to access CPAN and the FAQ.  I found a
reference to comm.pl under the expect section, and checked it out.  It
did not however seem to answer my question, unless of course I'm
missing something....which is entirely possible.  Any help I can get
is appreciated.


---
Mark A. Bainter          MCP, A+
Technical Engineer    mailto:mark@turnergroup.com
Turner Group          WWW: http://www.turnergroup.com
2707 Middlebury St.   Phone: 219-295-4290
Elkhart, IN 46516     Fax: 219-522-2964
--------------------------------------------------------------------------------------
 ex abusu non arguitur in usum                                      
 (the abuse of a thing is no argument against its use)  
--------------------------------------------------------------------------------------


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

Date: 2 Jul 1997 22:37:26 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Accessing Unix Modem ports via perl.  (Yes I checked DejaNews)
Message-Id: <5pel76$d6d@fridge-nf0.shore.net>

Mark Bainter (mark@michiana.net) wrote:
: I also tried to check CPAN and the FAQ which I was unable to access.
: I saw several people had asked this question, however, there were no

I would suggest looking into the POSIX modules, and using the termio
stuff.  You might want to refer to some documentation about
termio/POSIX to get some ideas.

I'm currently working on set of modules for modems / ppp / zmodem
based on the things mentioned above.  These modules will be uploaded
to CPAN in the future, but currently I'm not even close to having an
alpha.  Should happen sometime this summer, tho.  ;-)

The method you're using with +> won't work, anyways.  You'd have to
use +<, but there's really more to this picture about tty and your
modem that I can't really get into here without writing an epic about
it.  It's probable that tty/modem stuff (at very least reading and
writing a tty) will be discussed in a POSIX book which covers termio.

BTW, someone posted a modem script a couple of days ago that used
POSIX and termio.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Wed, 02 Jul 1997 17:42:35 -0600
From: ghent@bounty-hunters.com
Subject: BSD-DB and tied hash problem
Message-Id: <867882301.26935@dejanews.com>

I am attempting to get a very simple piece of code working:

#!/usr/bin/perl

use strict;
use DB_File;
use Fcntl;

my (%T,%A,$item,$t,$a);

tie %T,"DB_File","db1.db",0,0 or die $!;
tie %A,"DB_File","db2.db",0,0 or die $!;

foreach $item (sort keys %T) {
        printf "$item: $T{$item} - $A{$item}\n";
}


The above tie()s to 2 different BSD-DB files, loops through one of them,
and is supposed to print out matching items from both DBs.

However, this does not work. It will print out the items in %T correctly,
but only *some* of the corresponding %A items:

item1: 50 - yes
item2: 30 - no
item3: 20 -
item4: 70 -
item5: 10 -
item6: 80 -
item7: 60 - no

If I parse through the %A db by itself, those values are there, and show
up properly. There does not seem to be any pattern to which items are
displayed, but the output is the same each time.

Any help would be greatly appreciated.

- Ghent
Z2hlbnRAYm91bnR5LWh1bnRlcnMuY29t

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 02 Jul 1997 15:17:39 -0500
From: Igor Vulfson <igorv@styx.or.fedex.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Compression in Perl
Message-Id: <33BAB763.1A3F@styx.or.fedex.com>

Tom Phoenix wrote:
> There are many compression algorithms, depending upon your needs. But any
> publicly-available modules should be on CPAN. Tell us more if you need
> something more. Hope this helps!

I have no option of using Compress:Zlib because it requires zlib,
which in turn, needs to be compiled on the machine, which is out of
the question because I don't have C compiler on Irix 5.3 (out web
server), which sucks.

What I need is quick and dirty way to shrink a string in size
either using pack/unpack or some other means that I am not aware of.

iv ;)
-- 
Igor Vulfson                  |  Email: mailto:ivulfson@fedex.com
Senior Scientific Programmer  |  URL:   http://www.magibox.net/~unabest/
Operations Research, FedEx    |  Work:  (901)395-7358   Home: 
(901)624-0776


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

Date: Fri, 04 Jul 1997 00:44:38 +0200
From: Jonas Thvrnvall <labah@algonet.se>
Subject: Content type messages in frame?
Message-Id: <33BC2B56.6757@algonet.se>

Hello!

I'm using perl to create html text in a frame, actually i load three
other frames from this specific frame by loading 'empty documents' with
just javascript that creates html code for the other frames.
My problem is that i get 3 content types messages in the loader frame
that cover the graphics in it, like this

Content-type: text/html
Content-type: text/html
Content-type: text/html

I've tried to hide it with:
    print "<!--Content-type: text/html-->>\n\n";

It worked under windows but it won't work under the unix server.
How can i fix this problem,?


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

Date: Wed, 2 Jul 1997 15:51:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Clinton Herget <herget@iag.net>
Subject: Re: Error: Document Contains No Data
Message-Id: <Pine.GSO.3.96.970702155019.8392L-100000@kelly.teleport.com>

On Thu, 3 Jul 1997, Clinton Herget wrote:

> I am getting an error 'Document Contains No Data' from my browser. Does
> anyone know what causes this besides there being an extra 'Content-type'
> line?

Isn't that enough? :-)

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!

   http://www.perl.com/perl/
   http://www.perl.com/perl/faq/
   http://www.perl.com/perl/faq/idiots-guide.html

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 2 Jul 1997 21:19:09 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: exec perl script in html file
Message-Id: <tcyangECpn7x.BtB@netcom.com>

Your Frenchy English is understood -- but this is a Perl group, not
a CGI one ......  If you want a script to be executed when being loaded,
you need SSI (Server Side Include).

However, you have no way to know when the user *leave* the page, so you
cannot know how long he/she stays on a page.

Try the CGI groups for more details.

=================================================
Joelle D'Antin & Nicolas Gregoire wrote after talking to Zeus and Hercules:
: We know that it's easy to exec a script with a form,
: but we want that the script is exec when the html file is loaded.
: Because we want to know how long user stays on a page,the script records
: filename and time.

: I hope you understand my frenchy-english.

: thanks

--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: Wed, 2 Jul 1997 15:52:36 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Joelle D'Antin & Nicolas Gregoire <dantin@icp.grenet.fr>
Subject: Re: exec perl script in html file
Message-Id: <Pine.GSO.3.96.970702155126.8392M-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, Joelle D'Antin & Nicolas Gregoire wrote:

> We know that it's easy to exec a script with a form,
> but we want that the script is exec when the html file is loaded.

Use the script to generate the page, and it will have to be run when the
file is loaded. (Of course, somebody could cache the page, so that may not
do what you want.) Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 02 Jul 1997 17:40:41 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Finding users hostname
Message-Id: <33BACAD9.34116651@hotmail.com>

danny cantil wrote:
> Anyone know a way from Perl to figure out the hostname of the users
> accessing your page? I've been maintaining a guestbook and graffiti wall
> of sorts and have
> traced some attempts to splash obscene entries on both pages ...
> 
> I only get IP# with $ENV {'REMOTE_HOST'}...

Danny - 

Yours is not a Perl question.  It is a CGI question.  
Perhaps the nice folks in 

comp.infosystems.www.authoring.cgi

would be helpful.

(It sounds like the server is not providing hostnames, because
REMOTE_HOST is the proper variable.  Some web servers do not 
provide hostnames for efficiency reasons.)

Scott

PS - For an example listing of CGI-related variables, look at
<http://www.web100.com/~sib/cgi/cgitest.cgi>

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

Date: Wed, 2 Jul 1997 15:29:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: danny cantil <dancan@mozcom.com>
Subject: Re: Finding users hostname
Message-Id: <Pine.GSO.3.96.970702152639.8392F-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, danny cantil wrote:

> I only get IP# with $ENV {'REMOTE_HOST'}...

Then maybe you want to see whether you webserver could be configured to
give you more information there. 

On the other hand, if you want to do nslookup directly in Perl, check out
the gethostbyaddr function, listed in the perlfunc(1) manpage.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 2 Jul 1997 15:48:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Josh Kostecka <josh@palouse.org>
Subject: Re: Help Please
Message-Id: <Pine.GSO.3.96.970702154529.8392J-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, Josh Kostecka wrote:

> Subject: Help Please

Okay, but here's a way in which you can help us: Check out the frequent
posting about choosing good subject lines. Everybody who has a question
wants "Help Please"! :-)

> Becuase of Perl's greedy nature, I am having problems 

Perl's not greedy! :-)  But maybe you're thinking about regular
expressions and their greedy quantifiers. Each one has a lazy equivalent,
documented in perlre. Does that help?

But it looks as if you're trying to parse HTML. There are some modules on
CPAN that are made to do that, and most of them are already debugged. :-)

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 2 Jul 1997 15:31:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: how define random integer?
Message-Id: <Pine.GSO.3.96.970702152938.8392G-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, Eduardo Cavazos wrote:

> On Tue, 1 Jul 1997, Tom Phoenix wrote:

> > You can use the rand() function, possibly along with int(). Both are
> > documented in perlfunc(1). 

> If you'll be calling the rand function multiple times, then you should
> also call srand. 

And if you'll be calling the rand function just once, then you should also
call srand. :-)

But I didn't mention it in my answer because it should be found in the
docs, of course. Thanks for writing!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 2 Jul 1997 15:25:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dan Kubilos <dkubilo@oxnardsd.org>
Subject: Re: No output
Message-Id: <Pine.GSO.3.96.970702152540.8392E-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, Dan Kubilos wrote:

> When I run the script from the command line it kicks out perfect HTML
> 
> However when I call it from a web page I get an error 500.

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!

   http://www.perl.com/perl/
   http://www.perl.com/perl/faq/
   http://www.perl.com/perl/faq/idiots-guide.html

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 02 Jul 1997 21:39:19 GMT
From: s_haber@ira.uka.de (Marc Haber)
Subject: Package for working with a MS network?
Message-Id: <5pehnk$6ki$1@nz12.rz.uni-karlsruhe.de>

Hi!

I am looking for a perl package that will allow me to map a directory
on a remote Windows NT server to a local drive letter, as the net use
command does.

Is it possible to do without having to shell out for each net use
command?

Any hints will be appreciated.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | s_haber@ira.uka.de
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Wed, 02 Jul 1997 21:39:39 GMT
From: s_haber@ira.uka.de (Marc Haber)
Subject: Package to manipulate Windows 95 shortcuts (*.lnk)?
Message-Id: <5peho9$6ki$2@nz12.rz.uni-karlsruhe.de>

Hi!

I am looking for a package that can manipulate shortcuts (links) under
Windows 95. I'd like to be able to check whether a shortcut points to
a valid executable.

Any hints will be appreciated.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | s_haber@ira.uka.de
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Wed, 02 Jul 1997 22:58:29 GMT
From: shelle@interaccess.com (Shelle)
Subject: Re: Package to manipulate Windows 95 shortcuts (*.lnk)?
Message-Id: <5pemel$1vc_002@interaccess.interaccess.com>

s_haber@ira.uka.de (Marc Haber) wrote:
>Hi!
>
>I am looking for a package that can manipulate shortcuts (links) under
>Windows 95. I'd like to be able to check whether a shortcut points to
>a valid executable.
>
>Any hints will be appreciated.
>
>Greetings
>Marc

If you take a look at the CPAN ftp site (or one of the MANY mirrors) you will 
find "Win32 Shortcut" (Although it isn't showing the current version which is 
rather unusual for CPAN).  The current version is 0.03 (Dated April 7,1997), 
and the homepage for the module is at http://www.divinf.it/dada/perl/shortcut 
and you will find the file at 
http://194.247.167.1/DADA/PERL/SHORTCUT/Win32Shortcut-0.03.zip (44K).

Since this is one of Aldo Calpini's (AKA:  Dada") babies, it'll almost 
certainly install like a dream on your system and he always does his very best 
to provide plenty of documentation at his site to go around.


Michelle ----,-'-(@

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      I'm just a beginner with Perl but I read TFM....
 Michelle Feigen      ----,-'-(@      shelle@interaccess.com
          http://homepage.interaccess.com/~shelle/
       http://homepage.interaccess.com/~shelle/grafx/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 2 Jul 1997 22:30:26 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Perl  on Linux
Message-Id: <5pekq2$d6d@fridge-nf0.shore.net>

Ed Vander Bush (temp.ed.vanderbush@bentley.com) wrote:
: How well does Perl run on a Intel box running Red Hat Linux 4.2?
: compared to regular UNIX? Thanks,

No difference if Perl has been built correctly by Red Hat, or by you -
if you choose to build your own.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Wed, 2 Jul 1997 15:22:51 -0400
From: sysop@diamonds.com (Zisha Weinstock)
Subject: print reverse
Message-Id: <MPG.e2474988ad3d61989680@news.htp.net>

$foo = reverse("12345");
print $foo;

prints 54321

print reverse("12345");

prints 12345. Why?



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

Date: Wed, 02 Jul 1997 16:32:25 -0400
From: Michael Iles <thuja@internauts.ca>
Subject: Re: print reverse
Message-Id: <33BABAD9.4179@internauts.ca>

Zisha Weinstock wrote:
>    $foo = reverse("12345");
>    print $foo;
> prints 54321

Because you are assigning to a scalar ($foo), reverse is operating in a
scalar context. In a scalar context, reverse reverses its arguments
character-by-character. (This is what you expect.)
 
>    print reverse("12345");
> prints 12345. Why?

Here print expects a list context, and when reverse operates in a list
context it treats its arguments as a list and reverses the order of the
items in the list. In this case, the list has only one item ('12345'),
and reversing the order of a list containing only one item has no
effect.

You can force the reverse to be evaluated in a scalar context by using
'scalar':
   perl -e 'print scalar reverse q(12345);'

To explore this further, look at the output of,
   perl -e '@foo = reverse q(12345); print join q(:), @foo;'
   perl -e '$foo = reverse (q(12345),q(abcde)); print $foo;'
   perl -e '@foo = reverse (q(12345),q(abcde)); print join q(:), @foo;'

Mike.

-- 
Michael Iles, thuja@internauts.ca               /
http://www.internauts.ca/~thuja/ for PGP key   /   Think globally,
Ceci n'est pas une .sig                       /    drink locally.


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

Date: Wed, 2 Jul 1997 15:50:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Zisha Weinstock <sysop@diamonds.com>
Subject: Re: print reverse
Message-Id: <Pine.GSO.3.96.970702154900.8392K-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, Zisha Weinstock wrote:

> $foo = reverse("12345");

Scalar context.

> print $foo;
> 
> prints 54321
> 
> print reverse("12345");

List context.

> prints 12345. Why?

Because reverse, like most other operators in Perl, is context sensitive.
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 2 Jul 1997 21:12:16 GMT
From: xewj@odin.sunquest.com
Subject: Re: Require Problem
Message-Id: <5peg7g$1j2$1@iggy.sunquest.com>

In article <5pdn9b$121@news.acns.nwu.edu>,
Mark DePristo <mdepristo@Godzilla.cs.nwu.edu> wrote:
>[stuff snipped]
>Right now, taggerlibrary is as follows.  I'm not sur
>e if the require is wrong, the library is malformed, or both.
>Any suggestions?
>#!/usr/local/bin/perl
>sub tokenize {
>    local($IN) = $_[0];
>    $IN =~ s/\n//g;     #remove all NEW-LINES from input
>    $IN =~ s/ +/\n/g;   #replace " "s with NEW-LINES
>    $IN;                #return $IN
>}

AhHA! a homemade library!

While a RTFM response is completely justified in this case, here's the answer:
add "1;" to the end of your taggerlibrary.pm file.

Why? Because someplace, somewhere, the documentation says it is. Bloody heck,
I looked through the manpages and couldn't find it. I know it's in the camel
book, though. Maybe the local manpages are old...
Ah well, RTFM if you know the reference (grin).

Other than that, your small but effective library looks okay.



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

Date: 2 Jul 1997 23:16:03 GMT
From: chantane@JSP.UMontreal.CA (CHAN TANG Eric-Aubert)
Subject: Re: system() calling GNUplot
Message-Id: <5penfj$o35@epervier.CC.UMontreal.CA>

I tried the following :

my $COMMAND = "wgnuplot.exe ";
my $parameters = "plot.cmd";
system($COMMAND.$parameters);

but the program (GNUplot for Win32) never exit by itself,
I have to "kill the task" (it keeps running, so the output
file is still lock).


Executing directly the command (in a DOS window) :

wgnuplot.exe plot.cmd

works perfectly, the program exit as it should.

I tried with the DOS and Win16 version of GNUplot and
both works fine (with the "system(..)").


Any help would be appreciated.

-- 
  ____________________________________________________________
   (3/1R&() Eric-Aubert Chan Tang <chantane@JSP.UMontreal.CA>
            http://www.jsp.umontreal.ca/~chantane/


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

Date: Wed, 2 Jul 1997 15:33:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: jlinscom <jason@ccmail.dsccc.com>
Subject: Re: take linebreaks out of forms?
Message-Id: <Pine.GSO.3.96.970702153119.8392H-100000@kelly.teleport.com>

On Wed, 2 Jul 1997, jlinscom wrote:

> i need to take line breaks out of my 'text area' forms.  

> is there something i could substitute the line break with?  maybe a
> space?

Sure, that sounds good. What character is your "line break"? I'll assume
here that it's character \0x0a, although you might mean something else.

    $string =~ tr/\0x0a/ /;		# Change \0x0a to space

tr/// is documented in perlop. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 2 Jul 1997 21:12:55 GMT
From: "Sergio Loscialo" <nospam_sloscialo@chubb.com_nospam>
Subject: Trouble with Split command
Message-Id: <01bc872c$7ef49440$c61012ac@sloscialo.chubb.com>

I am having trouble using the split command with the following syntax:
   $s = 'PWNT803;P08;Aug. 1, 12, 14 (eves. M, T, Th. & Sat. Aug. 16)';
  @vals = split /;/, $s;

I figured I would get an array of length 3, but for some reason the command
is also splitting on the commas.

This may have been asked before, but I couldn't find anything online.  And
I 
couldn't find anthing in the Camel book either (edition 2).  That's not to
say
that the answer wasn't there, just that I might not have recognized it as
such.

Any help would be greatly appreciated.
-- 
Sergio Loscialo
Chubb Computer Services


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

Date: 2 Jul 1997 22:59:35 GMT
From: "Anthony Lee" <anthonyl@delphi.co.uk>
Subject: Re: uc function for PERL4
Message-Id: <01bc873c$223027a0$215748c2@default>

You could try,

sub uc {
  $_[0]=~tr/a-z/A-Z/;
  return $_[0];
} 

- Anthony Lee


Bruno Pagis wrote in article ...
> I've written a uc (capitalize) function for PERL4.
> There is more than one way to do it. Anybody wloud have a better idea ? 
> sub uc
> {
>   @t = unpack('C*', $_[0]);
>   $j=0;
>   foreach $i (@t)
>   {
>     if ($i>=97 && $i<=122)
>       { $t[$j] = $i -32; }
>     $j++;
>   }
>   return pack('C*', @t);
> }



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

Date: Wed, 02 Jul 1997 16:08:41 +0000
From: Kevin Schneider <schneide@storm.simpson.edu>
Subject: What does this do?
Message-Id: <33BA7D05.3EAA@storm.simpson.edu>

I'm fairly new to Perl and I'm trying to debug a script written by the
person I replaced.  Could somebody "interpret" the following line:

$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

Thanks in advance.

Kevin Schneider
schneide@storm.simpson.edu


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

Date: Thu, 03 Jul 1997 00:52:51 GMT
From: mupe@desk.nl (M. muPe)
Subject: Re: What does this do?
Message-Id: <5peps0$9hq$1@news2.xs4all.nl>

In article <33BA7D05.3EAA@storm.simpson.edu>, schneide@storm.simpson.edu wrote:
>I'm fairly new to Perl and I'm trying to debug a script written by the
>person I replaced.  Could somebody "interpret" the following line:
>
>$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>
>Thanks in advance.
>
>Kevin Schneider
>schneide@storm.simpson.edu

That matches a hex number and replaces it with ...
pack("C", hex($1)) 
hex($1) convert the hex number stored in temporay var $1 to decimal
pack("C", ..) converts to unsigned char (0 to 255)

I'm not a Perl wizard, but expecting a function to be executed in the
replacement part seems very exotic. 

Mathilde muPe


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

Date: Wed, 02 Jul 1997 17:18:13 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: When was PERL created?
Message-Id: <33BAC595.168E67BF@hotmail.com>

tim@hcirisc.cs.binghamton.edu wrote:
> 
> Does anyone have info on when PERL was created?  Some idiot wrote a
> proposal to my company saying that PERL has no practical application
> outside of the WWW.  So I wanted to know by how much PERL pre-dates

The Camel Classic seems to imply Perl was created in 1986.
(p. 381)

Scott

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

Date: 2 Jul 1997 22:45:31 GMT
From: kevinz@gazette.stortek.com (Kevin Zwack)
Subject: Re: When was PERL created?
Message-Id: <5pelmb$85o$1@news.stortek.com>

tim@hcirisc.cs.binghamton.edu wrote:
: Does anyone have info on when PERL was created?  Some idiot wrote a
: proposal to my company saying that PERL has no practical application
: outside of the WWW.  So I wanted to know by how much PERL pre-dates
: the web for a little extra oomph for my reply.  Thanks.

Many have posted replies of when Perl was created.  I just wanted to
add that I consider Perl a real language with practical uses.  We've 
written large applications in Perl, mostly engineering tools, which 
are used in a "production" mode every day.  

Perl easily replaces the Unix shells, Rexx, and C for day to day
tools development and other programming tasks.  In rewritting csh
and c programs, I often get a 10:1 or better reduction in the lines
of code, and the Perl versions are oftenusually more robust (due to
better parsing facilities, etc.)

And, yes, Perl is good for writing CGI programs as well.  :)

Regards,
-- 
Kevin Zwack			
Storage Technology Corporation	
Louisville, Colorado
(303) 673-2632			


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

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

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