[9867] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3460 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 16 21:07:18 1998

Date: Sun, 16 Aug 98 18:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 16 Aug 1998     Volume: 8 Number: 3460

Today's topics:
    Re: Array element var in a "foreach" loop? or an exhanc sneaker@fccj.org
    Re: Array element var in a "foreach" loop? or an exhanc (Ronald J Kimball)
    Re: Benchmark: shift vs. multiply <ljz@asfast.com>
        Client-server sockets question. <intermidi@mx2.redestb.es>
        COBOL and Perl birgitt@my-dejanews.com
    Re: COBOL and Perl (Abigail)
        DOS file management with PERL??? <ed_misley@hotmail_dot_.com>
    Re: eq and == difference (Craig Berry)
    Re: here's an implementation of diff in perl (Abigail)
        How can I place STDIN in my script? drsean1@my-dejanews.com
    Re: How can I place STDIN in my script? (Bob Trieger)
    Re: Local Perl Installation and Form Processing sneaker@fccj.org
    Re: Multi-line regex w/ multi-file loop <tingdale@flash.net>
    Re: newbie questions (M.J.T. Guy)
    Re: newbie questions (Abigail)
    Re: NULLS - printing to a socket??? (M.J.T. Guy)
    Re: Perl's equiv of "cc -DDEBUG" ? (M.J.T. Guy)
    Re: Perl's equiv of "cc -DDEBUG" ? (Tomoyuki Tanaka)
    Re: Perl's equiv of "cc -DDEBUG" ? (Abigail)
    Re: Perl's equiv of "cc -DDEBUG" ? (Abigail)
        PerlDoc TOC seems to have wrong page numbers (Kirill Sapelkin)
    Re: Q: How to read all the file name in a directory (Abigail)
    Re: Q: How to read all the file name in a directory <ljz@asfast.com>
    Re: Recommend a good editor <elflord@pegasus.rutgers.edu>
    Re: Recommend a good editor <elflord@pegasus.rutgers.edu>
    Re: Regex Mania - (was Re: X-file (?=...), case postpon (Mark-Jason Dominus)
        Request tracking system <walshg@indigo.indigo.ie>
    Re: retrieving hash name dzuy@my-dejanews.com
    Re: retrieving hash name (Craig Berry)
    Re: taint checking seems to slow down my code sneaker@fccj.org
    Re: testing if file exists <sysadmin@thegrid.net>
    Re: Web Applications Programmer <aperrin@mcmahon.qal.berkeley.edu>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 16 Aug 1998 21:31:15 GMT
From: sneaker@fccj.org
Subject: Re: Array element var in a "foreach" loop? or an exhanced grep ?
Message-Id: <6r7j33$ejn$1@nnrp1.dejanews.com>

In article <6r6ue6$3f2$1@monet.op.net>,
  mjd@op.net (Mark-Jason Dominus) wrote:
> In article <35D6D5FF.AD6C0784@sneex.fccj.org>,
> Bill 'Sneex' Jones  <bill@fccj.org> wrote:
> >What about $. (dollar sign period combo)?
>
> No, that only works for filehandles.  I had a sick fantasy that you
> could tie a filehandle to your array and read from it to get the
> elements and update $., but it doesn't work.
>
>

I, obviously, do not know enough yet, but I still
think you have something there.

Why does it have to be ONLY a filehandle.  Can't
there be 'anonymous' data streams?  How does Perl
know that _DATA_ and a filehandle are different, per se?

Just thinking out load :]

-Sneex-

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 16 Aug 1998 19:06:58 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Array element var in a "foreach" loop? or an exhanced grep ?
Message-Id: <1ddvb7k.19v7poc16t56o0N@bay1-306.quincy.ziplink.net>

<sneaker@fccj.org> wrote:

> In article <6r6ue6$3f2$1@monet.op.net>,
>   mjd@op.net (Mark-Jason Dominus) wrote:
> > In article <35D6D5FF.AD6C0784@sneex.fccj.org>,
> > Bill 'Sneex' Jones  <bill@fccj.org> wrote:
> > >What about $. (dollar sign period combo)?
> >
> > No, that only works for filehandles.  I had a sick fantasy that you
> > could tie a filehandle to your array and read from it to get the
> > elements and update $., but it doesn't work.
> >
> >
> 
> I, obviously, do not know enough yet, but I still
> think you have something there.
> 
> Why does it have to be ONLY a filehandle.  Can't
> there be 'anonymous' data streams?  How does Perl
> know that _DATA_ and a filehandle are different, per se?

>From perldata:

  The tokens __END__ and __DATA__ may be used to indicate the logical
  end of the script before the actual end of file.  Any following text
  is ignored, but may be read via a DATA filehandle: main::DATA for
  __END__, or PACKNAME::DATA (where PACKNAME is the current package) for
  __DATA__.

DATA *is* a filehandle.  :-)

(__DATA__ is a special token indicating the end of a script.  _DATA_ has
no special meaning.)

> Just thinking out load :]

Less thinking and more doing, please!

while (<DATA>) {
  print "$.\t$_";
}
__END__
This is
data after
the end of
the script.


Output:

1 This is
2 data after
3 the end of
4 the script.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 16 Aug 1998 18:23:00 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Benchmark: shift vs. multiply
Message-Id: <ltg1ewbm7v.fsf@asfast.com>

lr@hpl.hp.com (Larry Rosler) writes:

> In article <6r6147$6rk$1@mathserv.mps.ohio-state.edu> on 16 Aug 1998 
> 07:18:31 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> > [A complimentary Cc of this posting was sent to Lloyd Zusman 
> > <ljz@asfast.com>],
> > who wrote in article <lt4svdd3wu.fsf@asfast.com>:
> ....
> > > ...  As you can see, there is
> > > no significant difference in this environment between the use of bit
> > > shifts and multiplication/division by the corresponding power of 2:
> > 
> > This is not surprising.  Perl's operation dispatcher results in 200x
> > time overhead comparing with C code.  All the advantages of shift
> > vs. multiply will be hidden by this overhead.
> 
> Yes.  So the goal of the programmer should be the perspicuity of the code 
> (to borrow a delightful term from Nigel Chapman's book).

It indeed is delightful! ... and I believe that it's quite good
advice, as well.  After all, as time goes forward, cpu-seconds tend to
get cheaper and person-hours tend to get more expensive.  Therefore,
it makes good economic sense in most cases to write easily supportable
code.

I think, however, that it would be more perspicuous to use the word
"clarity" instead of "perspicuity" ...  :):)

> [ ... ]

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: Mon, 17 Aug 1998 01:34:32 +0200
From: "Jose" <intermidi@mx2.redestb.es>
Subject: Client-server sockets question.
Message-Id: <35d76ce9.0@news.arrakis.es>


Hi all.

Excuse me for my bad english.

Can anybody help me about this ?

I have a long URL list to verify, looking for broken ones.

I don't know sockets, but i found on the net some samples. So, i built a
little program to verify one URL, but it returns 'HTTP/1.1 403 Forbidden'.

The requested URL is http://www.eliana.com, but if i request
http://www.yahoo.com, it works ok ('HTTP/1.1 200').

This test was made under W95 and Perl for Win32, using a standard internet
provider account and a 28.8 modem. I don't know exactly the Perl version,
but in the release.txt file appears 'Build 304 - Mar. 22, 1997'


This is the program:


-------------------------------------------------------
#!/usr/bin/perl

require "find.pl";

$Verbose = 1;

$dato_http = "http://www.eliana.com/";

&Check_URL;

print "$response\n\n";

exit;

sub Check_URL {
 local($URL) = $dato_http;
 if ($URL !~ m#^http://.*#i)

  return;
 }
 else {
  if ($URL =~ m#^http://([\w-\.]+):?(\d*)($|/(.*))#) {
   $host = $1;
   $port = $2;
   $path = $3;
  }
  if ($path eq "") { $path = '/'; }
  if ($port eq "") { $port = 80; }
  $path =~ s/#.*//;
 }
 if ($Verbose) { print "  Checking URL: $URL\n"; }
 $AF_INET = 2;
 $SOCK_STREAM = 1;
 $sockaddr = 'S n a4 x8';
# chop($hostname = `hostname`);ppp114.200.redestb.es - 195.122.200.114
 chop($hostname = "Default\n");
 ($name,$aliases,$proto) = getprotobyname('tcp');
 ($name,$aliases,$port) = getservbyname($port,'tcp') unless $port =~
/^\d+$/;
 ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($hostname);
 if (!(($name,$aliases,$type,$len,$thataddr) = gethostbyname($host))) {
  return -1;
 }
 $this = pack($sockaddr, $AF_INET, 0, $thisaddr);
 $that = pack($sockaddr, $AF_INET, $port, $thataddr);
 if (!(socket(S, $AF_INET, $SOCK_STREAM, $proto))) {
  $SOCK_STREAM = 2;
  if (!(socket(S, $AF_INET, $SOCK_STREAM, $proto))) { return -2; }
 }
 if (!(bind(S, $this))) {
  return -3;
 }
 if (!(connect(S,$that))) {
  return -4;
 }
 select(S); $| = 1; select(STDOUT);
 print S "HEAD $path HTTP/1.0\n\n";
 $response = <S>;
 ($protocol, $status) = split(/ /, $response);
 close(S);
 $estado = $status;
 return $status;
}
-------------------------------------------------------

Thank you very much,
Jose.

mailto:intermidi@mx2.redestb.es






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

Date: Sun, 16 Aug 1998 20:30:56 GMT
From: birgitt@my-dejanews.com
Subject: COBOL and Perl
Message-Id: <6r7fi0$9a7$1@nnrp1.dejanews.com>

A couple of months ago I got here (clpm) the advice not using Perl
as the first language when starting to learn how to program. It was
recommended using PASCAL, C, AWK, and then Perl.

I will be exposed to COBOL programs on my first internship
and wonder if COBOL could replace the role of PASCAL for me.

Having skipped reading much about PASCAL, reading only about
C so far and not getting into Perl yet, I would like to know
if in general COBOL programs could be rewritten effectively in
Perl.

I saw a thread in comp.lang.cobol where someone indicated that
a three page COBOL program could be rewritten in AWK in five
lines, so I wonder if this might be the same with Perl.
Are there things in COBOL which can't  be done in Perl.
Are there any or many ?

Birgitt Funk



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 17 Aug 1998 00:31:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: COBOL and Perl
Message-Id: <6r7tk8$3ql$1@client3.news.psi.net>

birgitt@my-dejanews.com (birgitt@my-dejanews.com) wrote on MDCCCXI
September MCMXCIII in <URL: news:6r7fi0$9a7$1@nnrp1.dejanews.com>:
++ A couple of months ago I got here (clpm) the advice not using Perl
++ as the first language when starting to learn how to program. It was
++ recommended using PASCAL, C, AWK, and then Perl.
++ 
++ I will be exposed to COBOL programs on my first internship
++ and wonder if COBOL could replace the role of PASCAL for me.

No.

++ Having skipped reading much about PASCAL, reading only about
++ C so far and not getting into Perl yet, I would like to know
++ if in general COBOL programs could be rewritten effectively in
++ Perl.

Well, you can always write equivalent programs in Perl.

++ I saw a thread in comp.lang.cobol where someone indicated that
++ a three page COBOL program could be rewritten in AWK in five
++ lines, so I wonder if this might be the same with Perl.

Oh, yeah, for 3 line COBOL programs that might be true. But what
will you do for a 150,000 line COBOL program?

++ Are there things in COBOL which can't  be done in Perl.

No. They're Turing equivalent.

++ Are there any or many ?


COBOL was together with FORTRAN one of the first high level languages.
It dates from the late 40's/early 50's. Perl was developped 40 years
later. COBOL was a major achievement in its time, and developped by 
a remarkable woman, Admiral Grace Hopper. Perl was developped by a
remarkable man, Larry Wall. But where Hopper was a pioneer, Wall had
40 years of experience and gaining knowledge to work with.

That is why Perl is Perl, and nowhere near close to COBOL. That's also
why COBOL isn't suitable for modern programming. 



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: Sun, 16 Aug 1998 17:41:22 -0500
From: "Eduardo D. Misley" <ed_misley@hotmail_dot_.com>
Subject: DOS file management with PERL???
Message-Id: <35D76012.A56523C4@hotmail_dot_.com>

I do not know perl yet,  Is it possible accomplish this with  perl?

I need to write a DOS menu system to load GHOST image files to networked
machines.

what it should do:

    A disk will boot to the WinNT network map a drive that contains the
PERL script and run it. (have the network part done)

    the perl script will present the end-user with a menu, with multiple
sub menus. once the desired item is selected

    perl checks for the existence of the image file if it exists it runs
a dos executable with command line arguments that point to the image
file.

    if the file does not exist it should map more network drives and
look for file again.

If this is possible to do with perl I will learn it right away.
thanks
ed
______________________
ed_misley@hotmail*dot*com
For PGP Public Key finger
bivouac@cyberspace*dot*org



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

Date: 16 Aug 1998 21:59:41 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: eq and == difference
Message-Id: <6r7kod$768$1@marina.cinenet.net>

Andre L. (alecler@cam.org) wrote:
: > Essentially, == works for scalars such as numbers. eq works for
: > strings. You can check out the docs at http://www.perl.org/ for a more
: > complete run down of the perl comparison operators.
: 
: Strings are also scalars, may I point out. 

Exactly.  A fine example of yet another reason why consulting the doc is
superior to asking on clpm.

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


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

Date: 16 Aug 1998 20:58:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: here's an implementation of diff in perl
Message-Id: <6r7h4r$jcs$1@client3.news.psi.net>

Mark-Jason Dominus (mjd@op.net) wrote on MDCCCXI September MCMXCIII in
<URL: news:6r5vaa$2nt$1@monet.op.net>:
++ 
++ Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MDCCCX September
++ MCMXCIII in <URL: news:6r4lus$2as$1@mathserv.mps.ohio-state.edu>:
++ >++ I do not need to know the degree of
++ >++ difference, only the fact that the lines are different.
++ 
++ In article <6r5c60$5q8$2@client3.news.psi.net>,
++ Abigail <abigail@fnx.com> wrote:
++ >I fail to see how you can know two
++ >lines the same without somehow involving all characters.
++ 
++ Aren't you being obtuse here?  Obviously you can't know that they are
++ the same without looking at all the characters.  But you can certainly
++ know that they're different without looking at all the characters.


Uhm, as far as I know, 2 strings are either different, or the same.
And while it's true that in certain cases you don't have to look at all
characters to see that 2 strings are different, in the worst case you
do. Particulary in the case when you report "no difference".



Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

Date: Mon, 17 Aug 1998 00:31:32 GMT
From: drsean1@my-dejanews.com
Subject: How can I place STDIN in my script?
Message-Id: <6r7tl4$scs$1@nnrp1.dejanews.com>

Hi everyone,  I have a script where I want to take <STDIN> input and place it
as a part of my script.  Here it is:

$variable = "Hello";
$line = <STDIN>;
print ("$line world");


The input I want to send to STDIN is:
$variable

But when I run this, it prints out "$variable" literarly.  I want the output
to be "Hello world" and not "$variable world"  Can someone please help me? 
Thank you so very much!  ThanX!!

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Mon, 17 Aug 1998 00:48:54 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: How can I place STDIN in my script?
Message-Id: <6r7urd$ook$1@ligarius.ultra.net>

[ posted and mailed ]

drsean1@my-dejanews.com wrote:
-> Hi everyone,  I have a script where I want to take <STDIN> input and place it
-> as a part of my script.  Here it is:
-> 
-> $variable = "Hello";
-> $line = <STDIN>;
-> print ("$line world");
-> 
-> 
-> The input I want to send to STDIN is:
-> $variable
-> 
-> But when I run this, it prints out "$variable" literarly.  I want the output
-> to be "Hello world" and not "$variable world"  Can someone please help me? 
-> Thank you so very much!  ThanX!!

$variable = "Hello";
chomp ($line = eval <STDIN>);
print ("$line world");

Will do what you are trying to do, but for the life of me, I can't figure out 
why you'd want to do this.


Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972 
  Ext: 1949 and let the jerk that answers know 
  that his toll free number was sent as spam. "


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

Date: Sun, 16 Aug 1998 21:43:51 GMT
From: sneaker@fccj.org
Subject: Re: Local Perl Installation and Form Processing
Message-Id: <6r7jqn$fc4$1@nnrp1.dejanews.com>

In article <35C1B244.2A9FA976@whoever.com>,
  mc@whoever.com wrote:
> Bill 'Sneex' Jones wrote:
>
> > Martin C Brown wrote:
> >
> > If the Perl Script is 'perl scripting' from ActiveState, you can :)
>
> True, but I don't remember seeing an OS, and...
>
> > You can tell Winders to associate the perl script with an action,
> > like execute the ActiveState interpreter, and bam!  Instant
> > security hole :)
>
> Even on a local machine, I hate security bugs :))
>
> MC
>
>

I am re-replying here, I think my original reply was lost, so...

The OS platform used was implied by this line (taken from your reply
to the original poster):

<FORM METHOD=POST ACTION="file:///F|/perl/bin/order-power.cgi">

The ///F|/perl ... sure looks like Winders.  Hmmm...


HTH, :]
-Sneex-

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 16 Aug 1998 17:02:18 -0500
From: Tom Tingdale <tingdale@flash.net>
To: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Multi-line regex w/ multi-file loop
Message-Id: <35D756E9.4DDDC81F@flash.net>

> Thanks Ronald!

> I appreciate your thorough explaination with example code. I must have ten
> to twelve Perl books, but often the examples aren't very good for how I want
> to use a particular variable or concept. Other times it is difficult to put
> several pieces together at once for the first time.  The best way to learn
> is seeing lots of other (good) code. And even better is having a "mentor"
> like you that cares enough to help "put it together".  I'm off try it out.
> Thanks again!

Tom Tingdale
tingdale@flash.net



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

Date: 16 Aug 1998 20:09:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: newbie questions
Message-Id: <6r7e9j$brv$1@pegasus.csx.cam.ac.uk>

Steven Barbash  <stevenba@ccpl.carr.lib.md.us> wrote:
>Hello,
>
>What is the (easiest?) way to create a "duplicate" of the "." set or
>array of characters?
>
>Documentation in perlre.html defines the 'regular expression
>metacharacter' "." as 'Match any character except newline'.

Which suggests that the obvious simulation is  [^\n] .

>I want to create an identical set excluding the "\t" character.
>(More specifically, I want to search like "." but exclude the \t
>character.)

So that would be  [^\n\t] .


Mike Guy


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

Date: 17 Aug 1998 00:39:23 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie questions
Message-Id: <6r7u3r$3ql$2@client3.news.psi.net>

Steven Barbash (stevenba@ccpl.carr.lib.md.us) wrote on MDCCCXI September
MCMXCIII in <URL: news:35D72910.93B@ccpl.carr.lib.md.us>:
++ 
++ I want to create an identical set excluding the "\t" character.
++ (More specifically, I want to search like "." but exclude the \t
++ character.)

It's in perlre. Lookup [] and which role ^ plays.

++ Also, what is the procedure for listing/printing/displaying these system
++ defined sets? ".". "\s"(whitespace character), ...?


   print grep {/./} map {chr} 0x00 .. 0xFF;


Abigail
-- 
perl -we '$_ = q ?4a75737420616e6f74686572205065726c204861636b65720as?;??;
          for (??;(??)x??;??)
              {??;s;(..)s?;qq ?print chr 0x$1 and \161 ss?;excess;??}'


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

Date: 16 Aug 1998 20:18:08 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: NULLS - printing to a socket???
Message-Id: <6r7eq0$c76$1@pegasus.csx.cam.ac.uk>

Mnemonix <mnemonix@globalnet.co.uk> wrote:
>
>I have created a socket to another machine and am trying to print a NULL
>and newline character  to it:
>
>$null = 0;
>select S;	# where S is the socket
>print S ("$null\n");
>
>Perl is treating this as an ASCII string and consequently is sending  `30
>0Ah' over the wire as opposed to `00 0Ah'.
>I have tried 
>$null = '0x00';
>print S (hex($null));
>
>as well as oct()
>
>but both still send 30h as oppossed to 00h

RTFM.   Specifically the section on "Quote and Quote-like Operators"
in  perldoc perlop.

You want to create a string containing a single NUL.   Here are three ways:

  $null = "\0";
  $null = "\c@";
  $null = "\x00";


Mike Guy


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

Date: 16 Aug 1998 20:12:36 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl's equiv of "cc -DDEBUG" ?
Message-Id: <6r7efk$c3s$1@pegasus.csx.cam.ac.uk>

In article <6r7b0n$45j$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>
>In article <6r75k4$fdv$1@mark.ucdavis.edu>,
>Tomoyuki Tanaka <ez074520@dilbert.ucdavis.edu> wrote:
>> what's Perl's equiv of "cc -DDEBUG" ?
>>
>> where in the C code you'd have
>>
>> #ifdef DEBUG
>>	[print stuff]
>> #endif
>>
>
>There isn't one.

Actually, there is one.   See the -P switch in  perldoc perlrun.

Not that I'd recommend anyone to use it.


Mike Guy


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

Date: 16 Aug 1998 20:34:20 GMT
From: ez074520@dilbert.ucdavis.edu (Tomoyuki Tanaka)
Subject: Re: Perl's equiv of "cc -DDEBUG" ?
Message-Id: <6r7foc$ae5$1@mark.ucdavis.edu>


 hi.  thanks.  i just looked it up in "man perlrun".

 in Perl code, i always leave a space after "#" in a
 comment, e.g., as
	# comment line
	# another comment line

 if i do this, will cpp leave my comments alone
 and everything will be ok?


In article <6r7efk$c3s$1@pegasus.csx.cam.ac.uk>,
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
>>
>>> what's Perl's equiv of "cc -DDEBUG" ?
>>>
>>> where in the C code you'd have
>>>
>>> #ifdef DEBUG
>>>	[print stuff]
>>> #endif
>>>
>>
>>There isn't one.
>
>Actually, there is one.   See the -P switch in  perldoc perlrun.
>
>Not that I'd recommend anyone to use it.
>
>Mike Guy


-- 
;;; TANAKA Tomoyuki   ("Mr. Tanaka" or "Tomoyuki")
;;; http://www.cs.indiana.edu/hyplan/tanaka.html


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

Date: 17 Aug 1998 00:42:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl's equiv of "cc -DDEBUG" ?
Message-Id: <6r7uae$3ql$3@client3.news.psi.net>

M.J.T. Guy (mjtg@cus.cam.ac.uk) wrote on MDCCCXI September MCMXCIII in
<URL: news:6r7efk$c3s$1@pegasus.csx.cam.ac.uk>:
++ In article <6r7b0n$45j$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
++ >
++ >In article <6r75k4$fdv$1@mark.ucdavis.edu>,
++ >Tomoyuki Tanaka <ez074520@dilbert.ucdavis.edu> wrote:
++ >> what's Perl's equiv of "cc -DDEBUG" ?
++ >>
++ >> where in the C code you'd have
++ >>
++ >> #ifdef DEBUG
++ >>	[print stuff]
++ >> #endif
++ >>
++ >
++ >There isn't one.
++ 
++ Actually, there is one.   See the -P switch in  perldoc perlrun.

But that doesn't help you much. Without the -P switch, #ifdef DEBUG
is just a comment, and perl *will* execute the commands you don't
want to be executed. And using #ifndef doesn't help anything either.

-P turns on C preprocessing - but it doesn't do -D command line
switches. (Perl has -D, but that's for something completely different)



Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: 17 Aug 1998 00:48:56 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl's equiv of "cc -DDEBUG" ?
Message-Id: <6r7ulo$3ql$4@client3.news.psi.net>

Tomoyuki Tanaka (ez074520@dilbert.ucdavis.edu) wrote on MDCCCXI September
MCMXCIII in <URL: news:6r7foc$ae5$1@mark.ucdavis.edu>:
++ 
++  hi.  thanks.  i just looked it up in "man perlrun".
++ 
++  in Perl code, i always leave a space after "#" in a
++  comment, e.g., as
++ 	# comment line
++ 	# another comment line
++ 
++  if i do this, will cpp leave my comments alone
++  and everything will be ok?


No. It's legal to have spaces between '#' and a directive in cpp.


        $ perl5.00501 -Pw
        # if 0
        print "Foo\n";
        # endif 
        ^D
        $

That doesn't print anything.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: 16 Aug 1998 17:25:38 -0700
From: znanie@best.com (Kirill Sapelkin)
Subject: PerlDoc TOC seems to have wrong page numbers
Message-Id: <znanie.903313317@shell5.ba.best.com>
Keywords: PerlDoc TOC

In the Table of Contents file to the PerlDoc 5.005 the page numbers do not 
match the contents of the documentation.

For example, all of the contents of the first Chapter are listed as on
page 5.

Kirill


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

Date: 16 Aug 1998 20:59:28 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <6r7h7g$jcs$2@client3.news.psi.net>

Michael J Gebis (gebis@fee.ecn.purdue.edu) wrote on MDCCCXI September
MCMXCIII in <URL: news:6r609h$qri@mozo.cc.purdue.edu>:
++ abigail@fnx.com (Abigail) writes in messages Message-ID: <6r5p3q$au2$2@client3.news.psi.net> and Message-ID: <6r5pvr$b4i$1@client3.news.psi.net>
++  
++ }That sure beats asking in 'rec.cycling'
++ }"I just bought a bike. What do I do next?".
++ 
++ Dear God, you didn't just post that twice, did you?


I did. And I cancelled one.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


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

Date: 16 Aug 1998 18:15:05 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <ltiujsbml2.fsf@asfast.com>

fl_aggie@thepentagon.com (I R A Aggie) writes:

> In article <ltyaspbmkn.fsf@asfast.com>, Lloyd Zusman <ljz@asfast.com> wrote:
> 
> [me, in some article far, far, away]
> + > So, you're scorning TomC, eh? Ever consider the possiblity that Tom has
> + > feelings, too?
> 
> + I'm sure that Tom has feelings.  However, if he or anyone else who has
> + feelings makes a point of deliberately insulting others, then he or
> + she can expect to sometimes get responses in return that he or she
> + might not like, no matter how justified he or she might feel in
> + delivering these insults.
> 
> Ummm...if sarcasm where posted to the net, would anyone notice?

Well, in considering whether or not the remark was an example of
sarcasm, I went through the following chain of reasoning: if the
remark were sarcasm, then your statement would actually be saying that
there *isn't* a possibility that Tom has feelings.  I did not think
that you would actually be trying to make that assertion, so I assumed
non-sarcasm.

Perhaps I erred in my reasoning.

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: Sun, 16 Aug 1998 20:34:00 -0400
From: Donovan Rebbechi <elflord@pegasus.rutgers.edu>
Subject: Re: Recommend a good editor
Message-Id: <35D77A78.EB168DC4@pegasus.rutgers.edu>

Steve Bohler wrote:
> 
> I've searched through previous posts, but am not finding a recommendation
> for an easy-to-use Perl editor that runs on Windows.  I've used emacs
> before, but was wondering if there was something better.

you could try vim, which is a VERY enhanced vi version.
http://www.vim.org. It has syntax highlighting for perl among other
things. 

What do you mean when you say "easy to use" ? vim has  *** warning *** a
steep learning curve , but it is VERY easy to use once you are familiar
with it (things that are easy with vim are almost impossible with
notepad). If you are going to be editing a lot of text, I'd recommend
against using something just because it seems 'easy' to begin with.

cheers,
-- 
Donovan Rebbechi <elflord@pegasus.rutgers.edu>
http://pegasus.rutgers.edu/~elflord/
Web designer for Independence -- Linux for the Masses
http://www.independence.seul.org/


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

Date: Sun, 16 Aug 1998 20:36:03 -0400
From: Donovan Rebbechi <elflord@pegasus.rutgers.edu>
Subject: Re: Recommend a good editor
Message-Id: <35D77AF3.DD2B703B@pegasus.rutgers.edu>

Tom Christiansen wrote:
> 
> Probably not, but you could try vi(m).  It's easier in some ways,
> harder in others.
> 
> But don't expect to find a `Windows product' that can compare with
> either of them.

I'd say vim for windows is comparable to vim. However, having access to
the UNIX commands (to filter text) is a plus.

-- 
Donovan Rebbechi <elflord@pegasus.rutgers.edu>
http://pegasus.rutgers.edu/~elflord/
Web designer for Independence -- Linux for the Masses
http://www.independence.seul.org/


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

Date: 15 Aug 1998 03:56:03 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Regex Mania - (was Re: X-file (?=...), case postponed.)
Message-Id: <6r30sj$ran$1@picasso.op.net>


In article <6r2ecn$76$1@nnrp1.dejanews.com>,
Patrick Timmins <ptimmins@netserv.unmc.edu> wrote:
>I *do* understand how the regex engine works.

Oh, that's a relief.  I've been afraid that Ilya would get run over by
a bus or something and then nobody would understand how it worked.
-- 

mjd@pobox.com                                             Mark-Jason Dominus
mjd@plover.com                              Plover Systems, Philadelphia, PA


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

Date: Sun, 16 Aug 1998 22:21:19 +0100
From: Gerry Walsh <walshg@indigo.indigo.ie>
Subject: Request tracking system
Message-Id: <35D74D4F.B8EF7853@indigo.indigo.ie>

I'm looking at (a) replacing my existing request tracking system (b)
installing the ReqNG request tracking sytsem or (c) rolling out my own.
It's the usual sort of thing with tickets, email and web  interfaces and
various reporting/querying facilities. I also want to be
able to add dependencies between requests.

If anyone knows of some other Perl based request tracking system, I'd
love to hear about it. If not, well, I'll let you know how I got on in a
couple of months time.

(I know Byte tried a kind of newsgroup approach but it just doesn't seem
suitable for what I have in mind).

Gerry Walsh
(remove the extra ".indigo" to reply: walshg@indigo.indigo.ie)



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

Date: Sun, 16 Aug 1998 22:03:16 GMT
From: dzuy@my-dejanews.com
Subject: Re: retrieving hash name
Message-Id: <6r7kv3$h8i$1@nnrp1.dejanews.com>

In article <6r2gc5$cfh$2@marina.cinenet.net>,
  cberry@cinenet.net (Craig Berry) wrote:
> dnguyen@dejanews.com wrote:
> : I can think of a scenario when I would create the name of the hash on
> : the fly.  Suppose I need to parse the following file:
> :
> : 	varname = "TV show" {
> : 	    varname = "Flintstone" {
> : 		varname = "family" {
> : 		    othervar = "other stuff"
> : 		    varname = "flintstone" {
> : 			husband = "fred
> : 			wife    = "wilma"
> : 		    } # close of flintstone hash
>
> So you create a hash of hashes of hashes and so forth, so that e.g.
>
>   $stuff{'TV show'}{'Flintstone'}{'family'}{'othervar'}   is 'other stuff',
>   $stuff{'TV show'}{'Flintstone'}{'family'}{'flintstone'}{'husband'}
>                                                           is 'fred',
>
	Precisely, yes.  However, the number of hashes of hashes is unknown
	as the user can specify any number of levels deep.

> and so forth.  No need to 'name' the internal hashes other than as keys in
> the next higher hashes, with hash references as their values.
>
	Then I realize that there can be a somevar = "someval" which are key
	and value of the family hash.  This line can appear any where within
	the { } of the family hash.  I have to keep track of which hash level
	I'm currently at (by keeping track of the curly braces).  For example,
	I could have gone 2-3 level of hashes deep and all of a sudden, back
	to the family hash level.  I must remember the current hash of the
	current level.

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

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 16 Aug 1998 22:17:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: retrieving hash name
Message-Id: <6r7lq4$768$3@marina.cinenet.net>

dzuy@my-dejanews.com wrote:
: > and so forth.  No need to 'name' the internal hashes other than as keys in
: > the next higher hashes, with hash references as their values.
:
: 	Then I realize that there can be a somevar = "someval" which are key
: 	and value of the family hash.  This line can appear any where within
: 	the { } of the family hash.  I have to keep track of which hash level
: 	I'm currently at (by keeping track of the curly braces).  For example,
: 	I could have gone 2-3 level of hashes deep and all of a sudden, back
: 	to the family hash level.  I must remember the current hash of the
: 	current level.

Oh, you do that by keeping the current hash reference as a lexical ('my')
variable in your parsing subroutine, recursing down one level for every
open-brace, and back up one level for each close-brace.  The correct
lexical hash reference is thus always magically the visible one at any
given moment.

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


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

Date: Sun, 16 Aug 1998 21:28:01 GMT
From: sneaker@fccj.org
Subject: Re: taint checking seems to slow down my code
Message-Id: <6r7it1$eg2$1@nnrp1.dejanews.com>

In article <6r6tfu$3bf$1@monet.op.net>,
  mjd@op.net (Mark-Jason Dominus) wrote:
> In article <35D6D41D.B56E0C5D@sneex.fccj.org>,
> Bill 'Sneex' Jones  <bill@fccj.org> wrote:
> >Or you can look for another way around setuid.
>
> I imagine that you could write an xsub which would turn off taint
> mode completely.
>
> >Who started this whole setuid thing anyways?
>
> Dennis.
>

Do'Oh!  I forgot about that C thing  :]

-Sneex-

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Sun, 16 Aug 1998 20:36:35 GMT
From: "Casey Lee" <sysadmin@thegrid.net>
Subject: Re: testing if file exists
Message-Id: <01bdc955$b8a276a0$6302a8c0@cplee.thegrid.net>

if(-e 'foobar.htm') {
	# insert code here....
}



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

Date: Sun, 16 Aug 1998 15:38:01 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
To: ebs@ricochet.net
Subject: Re: Web Applications Programmer
Message-Id: <35D75F49.B426DAF6@mcmahon.qal.berkeley.edu>

A pioneer in the stinking morass of SPAM is looking for people too stupid
to figure out the right newgroup to post in.  The right candidate will
possess the perfect blend of ignorance, arrogance, and incompetence that
characterize this post and, by extension, its author and his/her employer.

ebs@ricochet.net wrote:

> A pioneer in the emerging digital greetings market, is
> looking for individuals who have loads of talent and
> thrive in a team environment. <snip!>...

-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting -  (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King
http://socrates.berkeley.edu/~aperrin        to e-mail me)
    e-mail wheres-andy@socrates.berkeley.edu to find me!
-------------------------------------------------------------




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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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