[7761] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1386 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 28 13:11:47 1997

Date: Fri, 28 Nov 97 10:00:22 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 28 Nov 1997     Volume: 8 Number: 1386

Today's topics:
     , but I can't go to bed now.  REGEXPS question - TIA $m~c%l&l!h#n@worldnet.att.net
     Re: , but I can't go to bed now.  REGEXPS question - TI (Jari =?ISO-8859-1?Q?M=E4kel=E4?=)
     Re: , but I can't go to bed now.  REGEXPS question - TI $m~c%l&l!h#n@worldnet.att.net
     Re: ??? $ENV ??? (brian d foy)
     Re: ??? $ENV ??? (Gerald Riechmann)
     Re: adding to the end of each element in an array (Emile Heyns)
     Re: camel vs llama <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
     Re: Cron (Tad McClellan)
     DBD package or RedHat problem? <rroberts@muller.com>
     Re: Form Result to E-mail <david.martin@biotek.uio.no>
     How can I change real UID under Solaris? <mikew@ico.com>
     How do I completely wipe a package from memory? (Rauli Ruohonen)
     LWP with NT <coke@mindless.com>
     Re: Net::FTP docs ? <mak@mark.dircon.net>
     Re: pattern substituition operation question (Tony Bass)
     Re: Perl & dBase files (Michael Ng)
     Re: Perl on Win32: Output file redirection clobbers fil <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
     Re: perl shorter than csh challenge!! (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Quick Reference? <tml@wans.net>
     Re: Quick Reference? (Honza Pazdziora)
     sort() corrupts data when using an "illogical" function <Sven.Neuhaus@de.uu.BLOCKSPAM.net>
     Re: Strange 'print Location:' problem with Perl <jamesr@aethos.co.uk.nospam>
     Re: Variable Pattern Options (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Which platform ? (Jonathan Stowe)
     Re: Which platform ? <emehenk@rioja.ericsson.se>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 28 Nov 1997 14:44:10 GMT
From: $m~c%l&l!h#n@worldnet.att.net
Subject: , but I can't go to bed now.  REGEXPS question - TIA
Message-Id: <65ml8t$bkn@mtinsc05.worldnet.att.net>

#  Why none of these are working?

$s_ = "bah baah  baaah ";

print "Go to bed now.\n" if (/a{1,3}/) ;
print "Go to bed now.\n" if (/a+/) ;
print "Go to bed now.\n" if (/a{1,}/) ;
print "Go to bed now.\n" if (/ba+/) ;
print "Go to bed now.\n" if (/ba{1,}/) ;
print "Go to bed now.\n" if (/ba*/) ;
print "Go to bed now.\n" if (/ba{0,}/) ;
print "Go to bed now.\n" if (/ba?/) ;
print "Go to bed now.\n" if (/ba{0,1}/) ;
print "Go to bed now.\n" if (/bah{1,3}/) ;

# Something simple, but I can't go to bed now.
# ver; Windows NT Version 4.0, Perl -v; This is perl, 5.004_02


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

Date: 28 Nov 1997 16:48:41 +0200
From: jari@iki.fi (Jari =?ISO-8859-1?Q?M=E4kel=E4?=)
Subject: Re: , but I can't go to bed now.  REGEXPS question - TIA
Message-Id: <lcg1oh3whi.fsf@ns2.avantcomp.fi>

$m~c%l&l!h#n@worldnet.att.net writes:

> #  Why none of these are working?

> $s_ = "bah baah  baaah ";

> print "Go to bed now.\n" if (/a{1,3}/) ;

[...]

Perhaps You should try to match the regex to $s_ and not to $_ like
this:

print "Go to bed now.\n" if ($s_ =~ /a{1,3}/) ;

Or perhaps You should go to bed and try again after a good night
sleep?

Jari



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

Date: Fri, 28 Nov 1997 14:55:11 GMT
From: $m~c%l&l!h#n@worldnet.att.net
Subject: Re: , but I can't go to bed now.  REGEXPS question - TIA
Message-Id: <65mltj$bkn@mtinsc05.worldnet.att.net>

On 28 Nov 1997 16:48:41 +0200, jari@iki.fi (Jari Mdkeld) wrote:

Thanks Jari! 
I don't know what to say........

>$m~c%l&l!h#n@worldnet.att.net writes:
>
>> #  Why none of these are working?
>
>> $s_ = "bah baah  baaah ";
>
>> print "Go to bed now.\n" if (/a{1,3}/) ;
>
>[...]
>
>Perhaps You should try to match the regex to $s_ and not to $_ like
>this:
>
>print "Go to bed now.\n" if ($s_ =~ /a{1,3}/) ;
>
>Or perhaps You should go to bed and try again after a good night
>sleep?
>
>Jari
>



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

Date: Fri, 28 Nov 1997 09:33:23 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: ??? $ENV ???
Message-Id: <comdog-ya02408000R2811970933230001@news.panix.com>

In article <65mg0j$pep3@lyra.hkstar.com>, "joeifox" <foxfox@hkstar.com> wrote:

>I have problems while executing the following pl file:

>print "Server Name: ", $ENV{'SERVER_NAME'}, "<BR>", "\n";

>I got the result as follow:

><HR><PRE>Server Name:   <BR>

>Would anyone tell me why I can't obtain the $ENV varible?

sounds like you are running this from the command line.  unless you 
have defined SERVER_NAME in the shell's environment, it isn't
there, so nothing shows up in your output.  checking the environment
from the command line is shell dependent, so check the man page
for your shell.   

>And why I need to run pl file by typing "perl filename.pl" at prompt to
>execute instead of typing file name only?

the shell needs to be able to find anything that it wants to execute,
so the script that you want to run has to be in one of the directories
in PATH, and it also needs to be in the hash that shell uses to keep
track of executables.   how you cope with this depends on your shell,
but if you are in the same directory as the script, you can use

   % ./script_name

to tell the shell to look in the current directory.

see the man page for your shell for more details.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 28 Nov 1997 15:14:48 GMT
From: grichman@cs.tu-berlin.de (Gerald Riechmann)
Subject: Re: ??? $ENV ???
Message-Id: <347ed2eb.690184@news.cs.TU-Berlin.DE>

"joeifox" <foxfox@hkstar.com> wrote on Fri, 28 Nov 1997 21:18:07
+0800:

> I have problems while executing the following pl file:
> 
> #!/usr/local/bin/perl
> print "Content-type: text/html", "\n\n";
> print "<HTML>", "\n";
> print "<HEAD><TITLE>About this Server</TITLE></HEAD>", "\n";
> print "<BODY><H1>About this Server</H1>", "\n";
> print "<HR><PRE>";
> print "Server Name: ", $ENV{'SERVER_NAME'}, "<BR>", "\n";
> print "Running on Port: ", $ENV{'SERVER_PORT'}, "<BR>", "\n";
> print "<HR></PRE>", "\n";
> print "</BODY></HTML>", "\n";
> exit(0);
> 
> I got the result as follow:
> 
> Content-type: text/html
> <HTML>
> <HEAD><TITLE>About this Server</TITLE></HEAD>
> <BODY><H1>About this Server</H1>
> <HR><PRE>Server Name:   <BR>
> Running on Port: <BR>
> <HR></PRE>
> </BODY></HTML>
> 
> Would anyone tell me why I can't obtain the $ENV varible?

You can. But the vars SERVER_NAME & SERVER_PORT are provided by the
Web-Server when you run it as a cgi, not in the shell!

> And why I need to run pl file by typing "perl filename.pl" at prompt to
> execute instead of typing file name only?

Prolly because u did not make it executable! Do a 
chmod 700 filename.pl
or
chmod 755 filename.pl

If it doesn't help, please check the perl-path in the first line of
the script. Do a "which perl" to check where the binary really is.

BTW: The "<<"-operator makes it easier to read and type:

print <<EOT;
Content-type: text/html

<HTML>
<HEAD><TITLE>About this Server</TITLE></HEAD>
<BODY><H1>About this Server</H1>
 ...
EOT

Cheers...
Gerald

-- 
Gerald Riechmann <grichman@cs.tu-berlin.de>
http://gerald-riechmann.home.ml.org/

          ;Sped up my 486; ran it on 220v! Works greO?_~"+ 


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

Date: Fri, 28 Nov 1997 16:19:19 GMT
From: qqehe@st5-oa6.oce.nl (Emile Heyns)
Subject: Re: adding to the end of each element in an array
Message-Id: <EKD6o7.4sw@oce.nl>

On Wed, 19 Nov 1997 09:43:34 +0200, Petri Backstrom wrote:
:> I know chomp can take a character or group of characters off each
:> element in an array.

Note: he wants to act on an *array*.

:> Is there something that can do the opposite?  In
:> otherwords if I have an array, and want to add \n to the end of each
:> element, is there a single command like chomp to do this?  I know a
:> simple foreach would do it, but what's the point.  This is
:> perl(shorter the better).
:
:If you search for "concatenation" in the free online Perl 
:documentation that comes with every proper distribution kit, 
:you will find a reference to the . (dot) operator:

which works on strings. What he wants is

@array = map { "$_\n" } @array;

Bye,

Emile
-- 
All I ask is a chance to prove that money can't make me happy.


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

Date: Fri, 28 Nov 1997 09:16:24 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
Subject: Re: camel vs llama
Message-Id: <65mueh$mrg@news.microsoft.com>

I'd get both and not worry too much about it. (In fact, that's what I did.
:D) Yes, the camel book is a much better reference, but the llama book gives
more examples about the subjects it covers. If you're working with Windows
I'd especially encourage you to get "Learning Perl," but in this case it's
called the Gekko Book because it has yet another animal on its cover. :D

As for the camel only being accurate only to 5.003, I don't know, but the
differences between 5.003 and whatever's current at the moment are going to
be minimal. I have a "magenta camel" that only goes up to 4.036 and pretty
much everything in it is still valid, though the language has of course
evolved from that point (e.g. you won't find references to references in the
magenta camel :D).

-- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl

Joe Keyes wrote in message <347C7D73.5101@mail.dec.com>...
>I have seen mention made on this group of the
>llama book being for programming newbies, and
>camel book being for programmers' reference in
>learning perl.
>
>Is that asessment accurate?
>
>Isn't the camel only up to 5.003?
>
>Joe Keyes




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

Date: Fri, 28 Nov 1997 08:11:31 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Cron
Message-Id: <jejm56.5k.ln@localhost>

Todd Smith (nospam.tbsmith@mindspring.com) wrote:
: Can someone tell me what this is, 


It is a way to have programs executed at specified times.


: how to use it, 


man cron
   and
man crontab

should get you started


: and where to get it?


It is included with Unix systems.


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


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

Date: 28 Nov 1997 10:11:46 -0500
From: Roland Roberts <rroberts@muller.com>
Subject: DBD package or RedHat problem?
Message-Id: <lnoh35qci5.fsf@bronze.muller.com>

I recently grabbed the DBD module and tried to install it on my RedHat
4.2 Linux (i386) system.  This was immediately *after* updating perl
with their perl 5.004 package.

When I build the DBD module, it wants to install itself in
/var/tmp/perl-root/usr/lib/perl5/site_lib.  Note the
"/var/tmp/perl-root" junk.  This creates a problem when I attempt to
install the DBI::Pg module.

Although I've looked through the camel book trying to understand
MakeMaker, I can't find where or why the /var/tmp/perl-root junk would
be there.  I've also search RedHat's archives but can't find anything.

Does this look like a perl problem or a RedHat problem?

roland
-- 
	      Roland B Roberts, PhD; rroberts@muller.com
     Muller Data Corp, 395 Hudson Avenue, New York, NY 10014 USA
		 Tel: 212 807-5143; Fax: 212 989-7193


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

Date: Fri, 28 Nov 1997 17:15:26 +0100
From: David Martin <david.martin@biotek.uio.no>
Subject: Re: Form Result to E-mail
Message-Id: <347EEE1E.A7DD0785@biotek.uio.no>

xianinfo@pub.online.xa.sn.cn wrote:
> 
> Hi, Everyone, Can someone tell me how to write
> a Perl Script to make the result of a form to E-mail contents
> and mail to the assigned destination?
> Thanks a lot!

Buy or borrow the Llama book. Read it. Especially chapter 19.
But read it all.
Then you can write one.
It is not difficult.
 ..d

-- 
* David Martin - Atherosclerosis and Thrombosis research group  *
* http://www.uio.no/~damartin/      david.martin@biotek.uio.no  *
* Lab +47 22 95 84 54 Fax +47 22 69 41 30  GSM +47 90 74 27 65  *


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

Date: 28 Nov 1997 17:07:07 +0000
From: Mike Williams <mikew@ico.com>
Subject: How can I change real UID under Solaris?
Message-Id: <v490u9aqwz.fsf@xi.i-co.co.uk>

I have a perl CGI script which set-uid root.  It's designed to authenticate
a user against the Unix passwd database, then assume the permissions of
that user.

I'm trying to change the real UID with the code

  $< = $userUid;

but perl (5.0 patchlevel 4 subversion 1) complains

  setruid() not implemented

My Solaris 2.4 system has no setruid() call, but it does have setuid().
Why doesn't perl use that?  How can I get the UID changed?

-- 
Mike Williams


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

Date: 28 Nov 1997 14:56:42 GMT
From: raulir@voimax.voima.jkl.fi (Rauli Ruohonen)
Subject: How do I completely wipe a package from memory?
Message-Id: <slrn67tmt9.lvv.raulir@voimax.voima.jkl.fi>

I tried to create a persistent perl interpreter (bound with C++), and all
went fine until I wanted to unload the files I had loaded. I used the code
from man page "perlembed", because I don't understand Perl well enough to
code that myself. The problem is that after I DeletePackage() those
packages, they still remain in memory. I want them out.. Now don't hit
that followup button just yet! I do not mean the kernel's behavior of not
returning freed memory to the application!

The basic idea is to load perl files on demand, reload them when they
change and unload them when they're no longer needed. If you know LPC MUDs
you know exactly what kind of behavior I want. When I reload a file the
previously defined functions should disappear, so I do DeletePackage()
there too - but since DeletePackage() does not work, :(

I have read the FAQ and the relevant man pages, but found nothing. I'm
currently using perl 5.004_01 on Linux. Is perl even capable of doing this
kind of thing?

Here are the files that don't work:

File "Init"
-----------

#!/usr/bin/perl

package main;

use strict;
use vars '%Cache';

LoadFile("test");
test::foo();
UnloadFile("test");
test::foo(); # This should fail, but it just prints "FOO!" :(

sub UnloadFile
{
        my $filename=$_[0];
        my $pkg=ValidPackageName($filename);

        print "Unloading file '$filename'.\n";
        if(!defined $Cache{$pkg}{mtime}) {
                print "File '$filename' hasn't been loaded!\n";
                return;
        }
        delete $Cache{$pkg};
        DeletePackage($pkg);
}

sub LoadFile
{
        my $filename=$_[0];
        my $package=ValidPackageName($filename);
        my $mtime=-M $filename;

        if(defined $Cache{$package}{mtime}&&$Cache{$package}{mtime} <= $mtime)
        {
                print "File '$filename' already compiled.\n";
        } else {
                local *FH;

                if(!defined $Cache{$package}{mtime}) {
                        print "Compiling file '$filename' as $package.\n";
                } else {
                        print "Recompiling file '$filename'.\n";
                        DeletePackage($package);
                        undef $Cache{$package};
                }
                if(!open(FH,"$filename")) {
                        print "Can't find file '$filename'!\n";
                        return 0;
                }
                local($/)=undef;
                my $sub=<FH>;
                close(FH);

                my $eval = qq{package $package; sub handler { $sub; }};
                {
                        my($filename,$mtime,$package,$sub);

                        eval $eval;
                }
                if($@) { return 0; }
                $Cache{$package}{mtime}=$mtime;
        }
        return 1;
}

sub DeletePackage
{
        my $pkg=shift;
        my ($stem,$leaf);

        no strict 'refs';
        $pkg="main::$pkg\::";
        ($stem,$leaf)= $pkg=~m/(.*::)(\w+::)$/;

        my $stem_symtab=*{$stem}{HASH};

        delete $stem_symtab->{$leaf};
}

sub ValidPackageName
{
        my($string) = @_;

        $string =~ s/([^A-Za-z0-9\/])/sprintf("_%2x",unpack("C",$1))/eg;
        $string =~ s|/(\d)|sprintf("/_%2x",unpack("C",$1))|eg;
        $string =~ s|/|::|g;
        return $string;
}

File "test"
-----------

use strict;

BEGIN {
        print "Test is initializing!\n";
}

sub foo
{
        print "FOO!\n";
}

return 1;

-- 
We all know Linux is great...it does infinite loops in 5 seconds.
                -- Linus Torvalds


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

Date: Fri, 28 Nov 1997 18:40:09 +1100
From: Coke <coke@mindless.com>
Subject: LWP with NT
Message-Id: <347E7559.F4B4B0E5@mindless.com>

I am a relative newmbie perler ("perler"? is that a word? hehe) and am
having some problems getting lwp to work, both I and my ISP run windows 
NT 4, and we both use Windows NT perl 5 version 5.001, i have played 
around with a copy of lwp, but cannot get it to work correctly, i am 
sure this is my fault, can you give me any notes on using it with 
windows NT perl 5?


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

Date: Fri, 28 Nov 1997 16:25:19 +0000
From: Mark Morgan <mak@mark.dircon.net>
Subject: Re: Net::FTP docs ?
Message-Id: <347EF06F.5CE0AE87@mark.dircon.net>

Alex Schajer wrote:
> 
> Hi,
> 
> Does anybody know where I can get some documentation for net::FTP
> 
> or better still could you tell me how to check a Transfer has got to
> it's destination?
> 
> Thanks
> 
> Alex
> 
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

'perldoc Net::FTP' should give instructions.  And you can do:
  $ftp->put($file) or print "Upload failed: $!";

to find out if it worked, and if not, then why...

Mark.


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

Date: 28 Nov 1997 15:01:11 -0000
From: aeb@brains.cartoon.bt.co.uk (Tony Bass)
Subject: Re: pattern substituition operation question
Message-Id: <65mmbn$8d1$1@brains.cartoon.bt.co.uk>

>From article <yf5k9dtp4h7.fsf@Owein.DoCS.UU.SE>, by Matz Kindahl <matkin@Owein.DoCS.UU.SE>:
> alecto <alecto@pe.BogusstrinG.net> writes:

>> jlee <jlee@mdsi.bc.ca> wrote:
>> >I want to delete all the white spaces from a string but do not want to
>> >delete the spaces that are between quotation marks. For example, if I
>> >have the following string:

>> >    test= "aaa aaa " bbb bbb "ccc ccc"   ddd  
>> Note:	           ^
>> Note:              ^ I am considering this space a typo
>> Note:	           ^ on the orginal poster's part

>> >and want the result to be:

>> >    test="aaa aaa"bbbbbb"ccc ccc"ddd


   join '', $test =~ m/("[^"]*"|[^" ]*)/g

elides unquoted spaces, yielding

   "aaa aaa "bbbbbb"ccc ccc"ddd

Elision of trailing quoted spaces is not impossible in this style but
looks awkward enough that I expect I would prefer an ordinary
mutation.

    Tony Bass

-- 
# A E Bass                                      Tel: (01473) 645305
# MLB 3/19, BT Laboratories                     e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 7RE   DO NOT e-mail to From: line
#                                               Opinions are my own


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

Date: 27 Nov 1997 07:30:02 GMT
From: syng@garlic.engr.ucdavis.edu (Michael Ng)
Subject: Re: Perl & dBase files
Message-Id: <65j7hq$rdh$1@mark.ucdavis.edu>

I think there is a xbase module available via www.perl.com, which allows 
access to dbase dbf file.  Never try it, though.  Have any successful case?
But, you still have to write your own program ;)

Rene Hertell (t1812@nospam.net) wrote:
::> Howdy!

::> I'm not sure if this is there right place toast this kind of question, so
::> please excuse me...

::> OK, My problem is to find a free perl script that makes html-pages from a
::> query to for example a dBase file (Excel file, comma file, etc.)

::> The file would contain a list of products my friend is selling. The table
::> would contain fields like:

::> product_category
::> product_name
::> model_number
::> price
::> image.gif
::> etc.

::> Thanks four your time,

::> Reni Hertell
::> t1812@myy.helia.spam-hater.fi
::> (please remove that spam-related stuff from my emailadress if you reply by
::> @-mail... :)


--
Michael (syng@engr.ucdavis.edu)
+--------------------------------------------------------------+
| http://www.engr.ucdavis.edu/~syng/                           |
| <PGP public key: http://www.engr.ucdavis.edu/~syng/mike.pgp> |
+--------------------------------------------------------------+


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

Date: Fri, 28 Nov 1997 09:28:03 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
Subject: Re: Perl on Win32: Output file redirection clobbers file?
Message-Id: <65mv4i$5bf@news.microsoft.com>

Can you post your code here? It sounds like what you're trying to do is

perl -e" . . . your code here . . . . " <foo >foo

which won't work under Wintel. There's almost certainly a way to do whatever
you're trying to do in Perl, although it may not be the way you think it
ought to be. It certainly isn't for me often enough.

Oh, and Windows does have file versions, but I honestly don't know whether
you can access them from the command line. You might be able to get the
version from Perl if you were to train it how to open up "Properties" in the
GUI, go to the "Version" tab and read the information under "File Version" .
 . . but then, if you did that it probably wouldn't be Perl any more, so
let's don't. :D

-- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl


Denis Haskin wrote in message <347C9466.BC792FE@iacnet.com>...
>Is this a known problem, and is it with perl or possibly the NT command
>interpreter?
>
>I just grabbed the binary of Gurusamy's perl5_00402-bindist04-bc.zip and
>installed it on my NT workstation 4.0 system (Intel) (-V output attached
>below).  It's working fine except command-line redirection when the
>input and output file are the same isn't working, even with the -i
>switch, and even with the -i switch with an extension (-i.bak).
>
>Is this a known problem?  It's mentioned briefly in one of the FAQs but
>there doesn't seem to be any indication that -i shouldn't work.  This is
>a little new to me, although I've been using Perl on VMS for years
>(where they have file versions... <grin>).
>
>Thanks for any suggestions...
>
>dwh
>
>--- perl -V output ---
>
>C:\vss\hits\spec>perl -V
>Summary of my perl5 (5.0 patchlevel 4 subversion 02) configuration:
>  Platform:
>    osname=MSWin32, osvers=4.0, archname=MSWin32
>    uname=''
>    hint=recommended, useposix=true, d_sigaction=undef
>    bincompat3=undef useperlio=undef d_sfio=undef
>  Compiler:
>    cc='cl', optimize='-O', gccversion=
>    cppflags='-DWIN32'
>    ccflags ='-MD -DWIN32'
>    stdchar='unsigned char', d_stdstdio=define, usevfork=false
>    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
>    intsize=4, alignbytes=8, usemymalloc=n, randbits=15
>  Linker and Libraries:
>    ld='link', ldflags ='-nologo -subsystem:windows'
>    libpth=c:\program files\devstudio\vc\lib
>    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
>comdlg32.li
>b advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib
>wsock32.
>lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
>    libc=msvcrt.lib, so=dll
>    useshrplib=undef, libperl=undef
>  Dynamic Linking:
>    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
>    cccdlflags='', lddlflags='-dll'
>
>
>Characteristics of this binary (from libperl):
>  Compile-time options: DEBUGGING
>  Built under MSWin32
>  Compiled at Aug  9 1997 21:42:37
>  @INC:
>    c:\perl\lib\site
>    c:\perl\lib
>    c:\perl\lib
>    c:\perl\lib\site
>    c:\perl\lib\site
>    .
>
>




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

Date: Fri, 28 Nov 97 11:28:38 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: perl shorter than csh challenge!!
Message-Id: <347ef192$2$ofn$mr2ice@speaker>

In <lq1ra81cmc1.fsf@bmers2e5.nortel.ca>, on 11/28/97 at 06:03 AM,
   Mark Mielke <markm@nortel.ca> said:
+-----
| Hey... i thought it was without using other than "basic" perl. FileHandle is
| "built-in" to perl in 5.004. (I don't even see a FileHandle.pm in the lib/
| directory... cool :-) ) In fact, i could have cut a few characters down...
+--->8

It's not in lib; it's in lib/(host)/(version).  And it's based on IO::File
(which is itself based on IO::Handle) in 5.004.

-- 
brandon s. allbery           [Team OS/2][Linux][JAPH]        bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                  KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
 `Greensleeves'."  ---unknown, quoted by Janet D. Miles in alt.callahans



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

Date: 28 Nov 1997 16:58:39 GMT
From: "Todd & Michelle Lietha" <tml@wans.net>
Subject: Quick Reference?
Message-Id: <01bcfc17$66b33840$2228cdd0@tml>

Can anyone recommend a good quick reference for perl (preferably for
v5.002)?



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

Date: Fri, 28 Nov 1997 16:35:28 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Quick Reference?
Message-Id: <adelton.880734928@aisa.fi.muni.cz>

"Todd & Michelle Lietha" <tml@wans.net> writes:

> Can anyone recommend a good quick reference for perl (preferably for
> v5.002)?

man perl online, $CPAN/authors/id/JV/perlref-5.004.1.tar.gz as
a PostScript nicely formatted booklet.

Hope this helps,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 28 Nov 1997 18:51:15 +0100
From: Sven Neuhaus <Sven.Neuhaus@de.uu.BLOCKSPAM.net>
Subject: sort() corrupts data when using an "illogical" function to sort.
Message-Id: <347F0493.30AB@de.uu.BLOCKSPAM.net>

Hi.. 

I think i've found a minor bug. I was trying to find a quick neat
way to randomize an array. I found something using sort() and rand()
that works ... but not always. It seems that certain results confuse
perl's sort() enough to corrupt the resulting array:

% perl -v
 
This is perl, version 5.004_04 built for sun4-solaris
 
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.

% perl -we '@a=(3,2,1);srand(time);@b=sort {int(rand(3))-1} @a;
print @b;'
Use of uninitialized value at -e line 1.
32%

As I mentioned, it doesn't happen often.

Regards,
-Sven Neuhaus
--
PS: $replyaddress =~ s/\.BLOCKSPAM// to reply by mail.


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

Date: 28 Nov 1997 17:16:39 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: Strange 'print Location:' problem with Perl
Message-Id: <01bcfc21$fd636080$26c0a4c1@kitkat.aethos.co.uk>

Andre L. <alecler@cam.org> wrote in article
<alecler-2611971532210001@dynppp-47.hip.cam.org>...
> In article <65fs8b$8hs$1@nntp2.ba.best.com>, "Tim Gilman"
> <tdgilman@DELETETHISbest.com> wrote:
[blah]
> $article = $in{'ArticleList'};
> print "Location: $article\n\n";
[blah]
> Hm. Not an expert, but... I think it is a string concatenation syntax
> error (look out for the dots -- and also the parentheses are missing):
> 
> print("Location: ".$article."\n\n");
> 

Hmmm... theres nothing wrong with the code, in the sense of Perl syntax.
Perl will quite happily interpolate variables into strings, and print
doesnt need ('s either.

In fact, i believe that your code might even be considered worse, because
to effect the concatenation, perl has to make multiple copies of the
strings (i think!)....

(1) I was wondering if you have to put a content-type string before the
Location....

(2) The other thing could be is that you might have funny characters in
your array (did you read it from a file? It might have CR/LF on the end of
the strings)

try

$article = "some valid location";
print "Location: $article\n\n";

This will answer (2) above.

James Richardson



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

Date: Fri, 28 Nov 97 11:31:44 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Variable Pattern Options
Message-Id: <347ef299$3$ofn$mr2ice@speaker>

In <347B403A.500F@gsao.med.ge.com>, on 11/25/97 at 03:16 PM,
   Greg Derzay 4-6601 GSAO <derzayg@gsao.med.ge.com> said:
+-----
| @matches = ($lines =~ /$pattern/$options);
| However, the compiler will not allow me to use the $options variable.
+--->8

Correct.  You need to use eval in this case:

    eval "\@matches = (\$lines =~ /\$pattern/$options);";

Preferably with error checking to catch bogus $options, and some smarts to
make sure nobody sneaks insecure nastiness into $options.

-- 
brandon s. allbery           [Team OS/2][Linux][JAPH]        bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                  KF8NH
"Never piss off a bard, for they are not at all subtle and your name scans to
 `Greensleeves'."  ---unknown, quoted by Janet D. Miles in alt.callahans



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

Date: 28 Nov 1997 15:30:27 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Which platform ?
Message-Id: <65mo2j$i1f@neon.btinternet.com>

In article <347EB827.1E93@rioja.ericsson.se>, emehenk@rioja.ericsson.se 
says...
>
>...
>Can anyone recommend a way to detect, from within a
>perl program, which platform it's running on.
>

The Config.pm module (if correctly implemented on your platforms) should
help. A quick "perldoc config" should give you a clue.

Jonathan....



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

Date: Fri, 28 Nov 1997 19:29:36 +0100
From: Henrik Soderstrom <emehenk@rioja.ericsson.se>
Subject: Re: Which platform ?
Message-Id: <347F0D90.5993@rioja.ericsson.se>

Henrik Soderstrom wrote:
> 
> Hi,
> I am writing a few little things in perl that I want to use
> both under W95 and unix (linux and solaris).
> 
> Can anyone recommend a way to detect, from within a
> perl program, which platform it's running on.
> 
> TIA /Henrik

OK - don4t bother. I got the solution by e-mail (special variable $^O
- thanks Peter).

/Henrik


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

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

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