[16205] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3617 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 11 03:05:24 2000

Date: Tue, 11 Jul 2000 00:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963299112-v9-i3617@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 11 Jul 2000     Volume: 9 Number: 3617

Today's topics:
    Re: <newbie> (11 .. 21) for arrays. (Rafael Garcia-Suarez)
        array, hashes = headaches <moishe@mitechnyc.com>
    Re: CGI Query string and Netscape <s0218327@unix1.cc.ysu.edu>
    Re: Comparing two strings (golf, anyone?) (Keith Calvert Ivey)
    Re: Comparing two strings (golf, anyone?) (Decklin Foster)
    Re: Comparing two strings (golf, anyone?) (Abigail)
    Re: Convert integers to strings (Gwyn Judd)
    Re: Crossing server bounderies <randy@theory.uwinnipeg.ca>
    Re: Crossing server bounderies <randy@theory.uwinnipeg.ca>
    Re: How do I tell PERL to create a new directory in Win (sky)
    Re: How do I tell PERL to create a new directory in Win (sky)
    Re: How to display the correct time from a time server  (Iain Chalmers)
    Re: How to display the correct time from a time server  (Matt Inger)
    Re: How to display the correct time from a time server  (Decklin Foster)
        Maintenance tools for PERL? - SURVEY - ridhamx@my-deja.com
        matching a block of text through RE. markahlstrom@excite.com
        Need help with scheduling tasks without Cron pastan@my-deja.com
    Re: need post/lwp example <debjit@oyeindia.com>
    Re: Net::SMTP question yong321@yahoo.com
        off-topic, "Compiler" technology <aotto@t-online.de>
        Parellel processing and concurrency control. <clee@innocent.com>
    Re: perl-5.6.0: Bug with "not" operator? (Rafael Garcia-Suarez)
        Perldb.ini, in win95 - file permissions (Steve A. Taylor)
    Re: Redirect messages to a file <bcaligari@shipreg.com>
    Re: Sill can't figure out random array (Decklin Foster)
    Re: String length? <uri@sysarch.com>
    Re: String length? (Gwyn Judd)
    Re: String length? (Craig Berry)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 11 Jul 2000 06:33:02 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: <newbie> (11 .. 21) for arrays.
Message-Id: <slrn8mlg5j.97l.rgarciasuarez@rafael.kazibao.net>

alexserve@my-deja.com wrote in comp.lang.perl.misc:
>I have an flat file text database and I have it
>tied to an array. I want to print 10 items from
>this database per page of viewing.
>I have the searching sorted but i want
>a "Browsable" style page also.
>
>For example i have 60 entries in my database with
>7 fields in each deliminated by a | (pipe). I
>want visitors to view 10 enties at a time.
>
>Right now I have this code:
>while (<DATA>) {

You read the DATA filehandle once here..

>    if (11 .. 21) {
>
>   @tabledata=split(/\s*\|\s*/, <DATA>);

And a second time here. That's why every second line is out.
Correction:
    @tabledata=split(/\s*\|\s*/, $_);

>   $id = $tabledata[0];
>   $title = $tabledata[1];
>   $website_url = $tabledata[2];
>   $email = $tabledata[3];
>   $software   = $tabledata[4];
>   $type   = $tabledata[5];
>   $page_url   = $tabledata[6];
>
>
>  print "<a
>href=\"$page_url\">$software</a><br>\n";
>
>    }
>}
>When i run this (according to the cookbook) I
>should get the entries from 11 through 21 and I
>do if I don't use an array. But if I tie the
>array perl prints only the even number entries
>between 11 and 21. Or if I want 12 through 22
>perl prints every odd entry.
[...]

-- 
Rafael Garcia-Suarez


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

Date: Tue, 11 Jul 2000 01:11:43 -0400
From: "moishe" <moishe@mitechnyc.com>
Subject: array, hashes = headaches
Message-Id: <smlb4huinu124@corp.supernews.com>

Hi there,

maybe someone can help me to load a file into

array/hash - whatever ...

The file looks like:

UID: 123
Name: moishe
Address: 23 Camle Lane
Phone: 555-2222
UID: 99999
Name: someone else
Address: somewhere
Phone: 111-3334

I may need to filter out some folks after I'll have it loaded.

I did something like:

while ( <DATA> ) {
    if ( /UID:\s+(.+)/ {
        $uid=$1;
    }
    if ( /Address:\s+(.+)/ ) {
        $users{$uid}{$address} = $1;
    }
        if ( /Phone:\s+(.+)/ ) {
        $users{$uid}{$phone} = $1;
    }
}

foreach $id ( keys %users ) {
    print "$id ";
    foreach $field ( keys %{ $users{$id} ) {
        print "\n\t$field: $users{$id}{$field} ";
    }
    print "\n";
}


But the output doesn't look too good:

123
    :    555-2222
99999
    :    111-3334

I know I am missing some basic understanding.
Please help.




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

Date: Tue, 11 Jul 2000 02:35:24 -0400
From: NagaPutih <s0218327@unix1.cc.ysu.edu>
Subject: Re: CGI Query string and Netscape
Message-Id: <Pine.A41.4.20.0007110207330.35364-100000@unix1.cc.ysu.edu>

On Mon, 10 Jul 2000, Tom Gederberg wrote:
> print "<A HREF=\"/cgi-bin/viewentry.pl?$date\">$title</A>";
> $query = $ENV{'QUERY_STRING'};

usually (if not the convention) form data is submitted in the
following format:

VAR1=value1&VAR2=value2&...


hence, to get the values properly, make the following modification:
1) change the HTML link to:

<a href="/cgi-bin/viewentry.pl?DATE=$date">$title</a>


2) add a form decoding/parsing code into your script:

$buffer=$ENV{'QUERY_STRING'};
$buffer=~s/\+/ /g;
foreach $item (split(/&/,$buffer)) {
  ($key,$val)=split(/=/,$item);
  $val=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $form{$key}=$val;
}

then finally your date value could be accessed by $form{'DATE'}

the above should work with ie, netscape, and other form-capable browsers.


g'luck.
-NagaPutih



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

Date: Tue, 11 Jul 2000 04:22:37 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Comparing two strings (golf, anyone?)
Message-Id: <396c9ed5.14921441@nntp.idsonline.com>

Bob Walton <bwalton@rochester.rr.com> wrote:

>sub compare{@a=map{split//}@_;$a=grep{$a[$_]eq$a[$_+@a/2]}(0..$#a)}

I can shave seven off that:

 sub compare{@a=map/./gs,@_;0+grep$a[$_]eq$a[$_+@a/2],0..$#a}

I'm not sure about assuming the two strings are the same length,
though.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: 11 Jul 2000 05:10:03 GMT
From: fosterd@hartwick.edu (Decklin Foster)
Subject: Re: Comparing two strings (golf, anyone?)
Message-Id: <8kea7a$298u0$2@ID-10059.news.cis.dfn.de>

Bob Walton <bwalton@rochester.rr.com> writes:

> If compare is always called in a scalar context:
> 
> sub compare{@a=map{split//}@_;grep{$a[$_]eq$a[$_+@a/2]}(0..$#a)}

sub compare{grep/\0/,split//,$_[0]^$_[1]}

Hmm, actually this is shorter and doesn't need scalar context:

sub compare{($a=$_[0]^$_[1])=~tr/\0//}

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: 11 Jul 2000 02:10:36 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Comparing two strings (golf, anyone?)
Message-Id: <slrn8mlfka.7v7.abigail@alexandra.delanet.com>

Bob Walton (bwalton@rochester.rr.com) wrote on MMDVI September MCMXCIII
in <URL:news:396A9386.F842A70A@rochester.rr.com>:
;; Matthew Zimmerman wrote:
;; ...
;; > (2) Less important, but certainly more fun, is this the shortest way to do
;; > it? Golf, anyone? My best shot is:
;; > 
;; > sub compare{@b=$_[1]=~/(.)/g;for($_[0]=~/(.)/g){$c++ if $_ eq $b[$i++]};$c}
;; > 
;; > Surely y'all can beat that.
;; 
;; sub compare{@a=map{split//}@_;$a=grep{$a[$_]eq$a[$_+@a/2]}(0..$#a)}
;; 
;; If compare is always called in a scalar context:
;; 
;; sub compare{@a=map{split//}@_;grep{$a[$_]eq$a[$_+@a/2]}(0..$#a)}


Beside the fact that the xor solution is shorter, the above is wrong
as well.

    compare "foobarfoo", "bar";

returns 6.



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


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

Date: Tue, 11 Jul 2000 04:51:50 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Convert integers to strings
Message-Id: <slrn8mla4i.61d.tjla@thislove.dyndns.org>

I was shocked! How could Abigail <abigail@delanet.com>
say such a terrible thing:
>Mark Lardinois (lardinois@ose.nl) wrote on MMDV September MCMXCIII in
><URL:news:39698d81$0$1748@heracles>:
>.. Hi,
>.. 
>.. Can someone tell me how to convert
>.. integers to strings. Is there something
>.. like IntToStr() or Str()?
>
>
>No, but you can easily make then yourself.
>
>    sub IntToStr {shift}
>
>    sub StrToInt {$_ [0]}

You have these around the wrong way.

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Reporter:   "What would you do if you found a million dollars?"
Yogi Berra: "If the guy was poor, I would give it back."


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

Date: Tue, 11 Jul 2000 01:27:52 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: Crossing server bounderies
Message-Id: <8keeu2$kli$1@canopus.cc.umanitoba.ca>

Lorenzo Gordon <lorenzo.gordon@lshtm.ac.uk> wrote in
   message news:8kca28$ddd$1@nnrp1.deja.com...
>
> I have the following situation and would massively appreciate any
> salvation offered:
>
> I have written a database using Ms Access 97.
>
> I am in the process of setting up a web-site, with which I am trying to
> add some'search' facility, using information stored on the Access
> Database.
>
> I have written a Perl script which, using the DBI.pm module, can go into
> the database and successfully pull out what I need.
>
> But: I work for an acadmic institution which runs the network using an
> Apache Server on a Unix Solaris machine.
> The web administrator and I are banging our heads against the brick wall
> that is the problem of trying to get a Unix machine to read an Access
> database.  We are unaware of and can find no evidnce of any ODBC-type
> driver that might allow the server to recognise the database.
[...]

As discussed in the FAQ section of the DBD::ODBC
module (see, eg,
http://theoryx5.uwinnipeg.ca/CPAN/data/DBD-ODBC/ODBC.html
), check out either http://www.openlinksw.com/ or
http://www.easysoft.com/ for packages which provide
access to a local ODBC data source from remote
clients, including unix ones.

best regards,
randy kobes





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

Date: Tue, 11 Jul 2000 01:27:52 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: Crossing server bounderies
Message-Id: <8kef0b$klj$1@canopus.cc.umanitoba.ca>

Lorenzo Gordon <lorenzo.gordon@lshtm.ac.uk> wrote in
   message news:8kca28$ddd$1@nnrp1.deja.com...
>
> I have the following situation and would massively appreciate any
> salvation offered:
>
> I have written a database using Ms Access 97.
>
> I am in the process of setting up a web-site, with which I am trying to
> add some'search' facility, using information stored on the Access
> Database.
>
> I have written a Perl script which, using the DBI.pm module, can go into
> the database and successfully pull out what I need.
>
> But: I work for an acadmic institution which runs the network using an
> Apache Server on a Unix Solaris machine.
> The web administrator and I are banging our heads against the brick wall
> that is the problem of trying to get a Unix machine to read an Access
> database.  We are unaware of and can find no evidnce of any ODBC-type
> driver that might allow the server to recognise the database.
[...]

As discussed in the FAQ section of the DBD::ODBC
module (see, eg,
http://theoryx5.uwinnipeg.ca/CPAN/data/DBD-ODBC/ODBC.html
), check out either http://www.openlinksw.com/ or
http://www.easysoft.com/ for packages which provide
access to a local ODBC data source from remote
clients, including unix ones.

best regards,
randy kobes





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

Date: 11 Jul 2000 03:56:41 GMT
From: tbsky.bbs@openbazaar.net (sky)
Subject: Re: How do I tell PERL to create a new directory in Win32?
Message-Id: <3bMDVf$XDr@openbazaar.net>

※ 引述《bart.lateur@skynet.be (Bart Lateur)》之銘言:
> sky wrote:
> >    mkdir "Mydir",'0777'
> >    this command won't set the directory permission  to  "0777"
> That is because 0777 != '0777';
> As a string, converted to a number, the digits are treated as decimal,
> so '0777' == 777!
> Just don't use the quotes.
>   mkdir "Mydir", 0777;

   Have u tried ?
   mkdir "Mydir",0777;
   i can't create a directory with permission "0777".
--
※ Origin: 網路邊攤 <linux.twbbs.org> 
◆ From: reverse-105-142.unicap.com.tw


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

Date: 11 Jul 2000 03:59:29 GMT
From: tbsky.bbs@openbazaar.net (sky)
Subject: Re: How do I tell PERL to create a new directory in Win32?
Message-Id: <3bMDZH$VeE@openbazaar.net>

※ 引述《vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)》之銘言:
> On 08 Jul 2000 03:13:58 GMT, sky <tbsky.bbs@openbazaar.net> wrote:
> >    i never got success when using this kind of command.
> >    i use linux and hp-ux.
> >    mkdir "Mydir",'0777'
> >    this command won't set the directory permission  to  "0777"
> >    i don't know how to create directory with the permissions
> >    i want...
> >    can anyone tell me how to do this?
> >    thanks for u help !!!
> And what is your umask value.  This umask can be set in your shell profile
> and defines some bits which should be subtracted from all creation modes
> when you create files or directories.  If umask is 022 then when
> you create a directory with permissions you get 755 because of the unask.
> There should be a umask procedure in the POSIX module, which can be used
> to modify it.
> Villy

   i know how to create a directory with "umask" and "mkdir" under shell.
   but i don't know how to do with perl's "mkdir"...
   can u show me an example to create a directory with permission
   "0777"?
   thanks for ur help!!!

   Best Regards,
   Tbsky
--
※ Origin: 網路邊攤 <linux.twbbs.org> 
◆ From: reverse-105-142.unicap.com.tw


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

Date: Tue, 11 Jul 2000 14:28:09 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: How to display the correct time from a time server on a page?
Message-Id: <bigiain-1107001428090001@bigman.mighty.com.au>

abigail wrote:

>Ryin (Ryin@mailmenot.com) wrote on MMDV September MCMXCIII in
><URL:news:idikmsk36lfiip654a796atsb0sr2rgqco@4ax.com>:
>`` Have seen many javascript clocks get the time from users'
>`` systems.  Is it possible to display a correct time from a
>`` time server when a page is viewed?
>
>
>#!/opt/perl/bin/perl -wT
>use strict;
>print <<__END__
>Content-type: text/plain
>
>Please look at your watch.
>__END__
>
>
>HTH. HAND.
>
>
>
>Abigail

You've got a bug here, Ryin asked for time from a _server_, I'd suggest:

#!/opt/perl/bin/perl -wT
use strict;
print <<__END__
Content-type: text/plain

Please go out to a cafe for a coffee, and ask your server the time.
__END__

(Note: this may return the incorrect time if your chosen cafe is in a
different timezone...)
cheers

big


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

Date: Tue, 11 Jul 2000 04:40:01 GMT
From: mattinger@mindless.com (Matt Inger)
Subject: Re: How to display the correct time from a time server on a page?
Message-Id: <396aa2ea.16739127@news.phoenixdsl.com>

<script language="javascript">
document.write( new Date());
</script>


see the Date object in the javascript reference
at developer.netscape.com

(this works in IE as well)


On Mon, 10 Jul 2000 18:16:39 -0400, Ryin <Ryin@mailmenot.com> wrote:

>Have seen many javascript clocks get the time from users'
>systems.  Is it possible to display a correct time from a
>time server when a page is viewed?
>
>Any input is welcome.  Live example is better.



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

Date: 11 Jul 2000 05:13:14 GMT
From: fosterd@hartwick.edu (Decklin Foster)
Subject: Re: How to display the correct time from a time server on a page?
Message-Id: <8kead9$298u0$3@ID-10059.news.cis.dfn.de>

Iain Chalmers <bigiain@mightymedia.com.au> writes:

> Please go out to a cafe for a coffee, and ask your server the time.

Yuck! You know I hate it when people go to all the trouble of using
Java just to show people what time it is...

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Tue, 11 Jul 2000 05:20:54 GMT
From: ridhamx@my-deja.com
Subject: Maintenance tools for PERL? - SURVEY -
Message-Id: <8kearb$tg7$1@nnrp1.deja.com>

Hello all,

I am conducting a survey to build a framework for evaluation of
software maintenance tool. I am looking for fairly basic information,
such as what tools you use and what kinds of things you look for.
If you are interested, please visit:
http://hockeytown.eas.asu.edu/~ridha/surveyintro.html

Your comments, suggestions, or ideas will be appreciated.
Thanks in advance for your participation and contribution on this
research.

--

M.Ridha
Software Engineering Research Group
Department of Computer Science & Engineering
Arizona State University


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 11 Jul 2000 04:18:41 GMT
From: markahlstrom@excite.com
Subject: matching a block of text through RE.
Message-Id: <8ke76m$r3v$1@nnrp1.deja.com>

I'm having trouble matching a block of text and I was wondering if
anyone has any ideas. I'm using
	/bla/ ... /bla bla/
to grab several lines. The problem is that's it's too greedy. It will
grab the last /bla bla/ when I want it to grab and stop at the first
/bla bla/.

Any suggetions would be greatly appreciated.

Mark A.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 11 Jul 2000 05:14:32 GMT
From: pastan@my-deja.com
Subject: Need help with scheduling tasks without Cron
Message-Id: <8keafg$tbd$1@nnrp1.deja.com>

Hello All,

 I don't have an opportunity to use Cron or similar features. How can I
implement scheduling by means of Perl functions such as fork, kill,...?

 Thank You, all

Regards,
Andrew


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 11 Jul 2000 09:46:40 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: need post/lwp example
Message-Id: <8kfbvk$f9$1@news.vsnl.net.in>

A couple of of days back I faced the same situation! I pasted the example
code and it gave bad luck this time. So I posted(well not to usenet) to
another cgi script residing in a different machine. It succeeded.
--------------------------- first program(lib-www-test.pl)
print qq`content-type: text/html

`;
# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);

# Create a request
my $req = new HTTP::Request POST =>
'http://192.168.1.20:8001/oyebin/develop/ad_serving/libtest.pl';
$req->content_type('application/x-www-form-urlencoded');
$req->content('fname=Debjit&lname=Mukherjee');

# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
 print $res->content;
 } else {
 print "Bad luck this time\n";
}

---------libtest.pl-----------------
use CGI 'param','header';
use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
print $cgi->header;
my $fname = $cgi -> param('fname');
my $lname = $cgi -> param('lname');
print qq`Hi $fname $lname how are you?`;
-------------------------------------------------------

and output
http://127.0.0.1/cgi-bin/lib-www-test.pl
gives
Hi Debjit Mukherjee how are you?
of course you can test in the same server as well.




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

Date: Tue, 11 Jul 2000 04:29:49 GMT
From: yong321@yahoo.com
Subject: Re: Net::SMTP question
Message-Id: <8ke7rf$rgh$1@nnrp1.deja.com>

In article <396A1450.15684EC4@attglobal.net>,
  Drew Simonis <care227@attglobal.net> wrote:
> yong321@yahoo.com wrote:
> >
> > My question is, do I also need to put the first and last lines shown
> > above in the foreach block? I don't think I need to create the $smtp
> > object, destroy it, and recreate it for the next person, but not
sure.
> > Thanks for a reply.
> >
>
> What happened when you tried it?

When I tried it, it seems to work. But my boss complains he can't
receive mail sent from my program. Not sure if it's the problem of the
mail server.

Just found that some email addresses in our database are so wrong that
they're even syntactically incorrect, for example, "test@". I wonder if
my program aborts the loop rather than skips (ignores) these bad
addresses.

--
Yong Huang

(yong321@yahoo.com)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 11 Jul 2000 08:16:59 +0200
From: Andreas Otto <aotto@t-online.de>
Subject: off-topic, "Compiler" technology
Message-Id: <396ABBDB.FFCD95A4@t-online.de>


Sorry,

  this is off topic but i think very interesting for the
  perl community.

  At http://home.t-online.de/home/aotto/comp-main_E.html

  you can download a *real* tcl compiler. It compiles
  *every* tcl or tk script into *native* very very fast
  C code and creates an executable or dynamic library.

  The underlying technology "Token-Stream" works for all
  scripting languages like *perl* or *python* too.


mfg

  aotto :) 

-- 
================================================================
Andreas Otto              Phone: ++49-(0)8152-399540
IPN Ingenieurbuero fuer   mailto:aotto@t-online.de
    Praezisionsnumerik    Web: http://home.t-online.de/home/aotto
Ulmenstrasse 3            Skills: Unix,Sql,Tcl,Shell,Sybase...
D-34289 Zierenberg        Area: Bank, FX, MM, shares, options
=================================================================


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

Date: Tue, 11 Jul 2000 04:40:38 GMT
From: Chris Lee <clee@innocent.com>
Subject: Parellel processing and concurrency control.
Message-Id: <396AA60A.9A6A4DF9@innocent.com>

Hi,

I am wondering if there is any perl package(s) for parellel processing
and concurrency control. I know that perl has fork() in unix
environment, but not for the win32 plateform. Besides, is there any
concurrency control features (eg. semaphore) in perl packages?

Thanks,

-- Chris


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

Date: Tue, 11 Jul 2000 06:04:51 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: perl-5.6.0: Bug with "not" operator?
Message-Id: <slrn8mlegp.95s.rgarciasuarez@rafael.kazibao.net>

mike@excite.com wrote in comp.lang.perl.misc:
>Earlier, Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>>In fact, this is a feature. 'not' followed by parentheses behaves now like a
>>list operator. Look at perldelta.
>
>Doh!  I can't believe I didn't see that.  Thanks.
>
>I don't think I like this change, though.  This removes most of the
>usefulness of the not operator, in my opinion.

I think this change was made to make constructs like
      not($a) || $b
more intuitive.

-- 
Rafael Garcia-Suarez


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

Date: Tue, 11 Jul 2000 04:03:38 GMT
From: an400@freenet.carleton.ca (Steve A. Taylor)
Subject: Perldb.ini, in win95 - file permissions
Message-Id: <396a9ab1.1500118@news.ncf.carleton.ca>

How do I set permissions on perldb.ini  -- the debugger says 

	Must not source insecure rcfile d:\server\cgi-bin/perldb.ini.
	You or the superuser must be the owner, and it must not
	be writable by anyone but its owner.

(when I put routines in perldb.ini and call % perl -d test.cgi
Nothing I've read in Fcntl, sysopen or elsewhere explains
how to change it, or whether the directory must be  changed also

Win32::FileSecurity says WinNt only.
Can I create a registry key?





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

Date: Tue, 11 Jul 2000 06:16:39 +0200
From: "Brendon Caligari" <bcaligari@shipreg.com>
Subject: Re: Redirect messages to a file
Message-Id: <8ke6fn$p4h$1@news.news-service.com>

<martinru@my-deja.com> wrote in message news:8kammk$2pb$1@nnrp2.deja.com...
> I am writing a Perl program that is giving me more errors than can fit on
the
> screen. I am running it from the MS-DOS command line (Windows 98).
>
> Is there a way to have those errors redirected to an output file so that I
> can see the errors that are being rolled off the screen? -Thanks.
>

in nt4/win2000 (not sure about 9x) you can set the properties of the console
box to 'scrollable'.  In this way you can 'scroll up' beyond the height of
the 'visible' area of the console box.




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

Date: 11 Jul 2000 04:29:57 GMT
From: fosterd@hartwick.edu (Decklin Foster)
Subject: Re: Sill can't figure out random array
Message-Id: <8ke7s0$298u0$1@ID-10059.news.cis.dfn.de>

Marcus Ouimet <mouimet@direct.ca> writes:

> I have been trying to figure this out for sometime and it is most
> likely something little I am overlooking.

<fisher_yates_shuffle from perlfaq snipped>

Um, what exactly is the problem you are having with it? Can you give
an example of code where you try to use it and it doesn't work? I
didn't have any trouble with that code when I used it a while ago.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Tue, 11 Jul 2000 04:12:23 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: String length?
Message-Id: <x766qdmhjs.fsf@home.sysarch.com>

>>>>> "JS" == John Stanley <stanley@skyking.OCE.ORST.EDU> writes:

  JS> Lighten up. It was a joke. I'm sorry you didn't find it
  JS> funny. Maybe by your reaction I win the most ridiculous way to
  JS> length a string award.

that was my whole point. your answer wasn't amusing. the two lines that
did nothing is not part of writing bad but working code. i can write
anything long by adding extraneous lines that do nothing. and i am not a
judge in this thread (just in the perl golf apocalypse coming to the
tpc4 near you. see www.sysarch.com/perl/golf)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 11 Jul 2000 04:47:18 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: String length?
Message-Id: <slrn8ml9s3.61d.tjla@thislove.dyndns.org>

I was shocked! How could Ala Qumsieh <aqumsieh@hyperchip.com>
say such a terrible thing:
>
>"Simon H." <srh104@york.ac.uk> writes:
>
>> Is there a quick way in Perl (like the predefined methods in, say, Java)
>> to get the length of a string in terms of number of characters?
>
>Everybody so far has given you some kind of answer (sarcastic or
>not). Don't listen to them! String length is a function of Heisenberg's
>principle:
>
>	sub heisenbergs_length {
>		my $s = shift;
>
>		my $length = 0;
>
>		$_ >= 0.5 && $length++ while $_ = rand > 0.1;
>
>		$length;
>	}
>
>Note that the length changes as you are trying to measure it, just as
>Heisenberg predicted.

I am thinking "why not use a hash?":

sub hash_brownies_anyone {
  my $string = shift;

  return 0 if $string eq "";

  my %l;

  $l{$_}++ for (split //, $string);

  my $length;

  $length += $_ for (values %l);

  $length;
}

-- 
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
The typewriting machine, when played with expression, is no more
annoying than the piano when played by a sister or near relation.
		-- Oscar Wilde


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

Date: Tue, 11 Jul 2000 06:48:26 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: String length?
Message-Id: <smlgpq5snu49@corp.supernews.com>

Ilmari Karonen (iltzu@sci.invalid) wrote:
: The idea was to find the length of the string _without_ using length(),
: preferably in the most perverse possible way.  I still think my binary
: search satisfied that requirement quite well, by applying not just one
: but two different optimizations without addressing the actual cause of
: its inefficiency in any way.

Yeah, by the authority vested in me by being the one who suggested this
ongoing disaster, you win so far. :)

Here's my latest:

  sub short_stupid_length {
    split //, shift;
  }

I find this attractive because although it's short, it manages to be
highly bogus on a few levels.  Notably, it depends on deprecated behavior
of split in a scalar context, shifts out of @_ just in time to avoid that
deprecated split behavior nuking that variable, *and* goes badly awry if
not called in a scalar context.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3617
**************************************


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