[12813] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 223 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 22 05:07:25 1999

Date: Thu, 22 Jul 1999 02:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 22 Jul 1999     Volume: 9 Number: 223

Today's topics:
    Re: Appending to a file under NT (elephant)
    Re: Appending to a file under NT <swiftkid@bigfoot.com>
    Re: Appending to a file under NT (elephant)
    Re: Array problem (Abigail)
    Re: basename regexp? (Andreas Fehr)
    Re: basename regexp? (Andreas Fehr)
        C++ from perl <FirstName_LastName@japan.ml.com>
    Re: Difference between Win32::ODBC and Win32::OLE <alain.borgo@ratp.fr>
    Re: How do I do a date string (ala from strftime) conve (Abigail)
        how to avoid truncation error? (GEMINI)
    Re: how to avoid truncation error? (Andreas Fehr)
    Re: how to avoid truncation error? (Andreas Fehr)
    Re: index.cgi script help <mike@customautotrim.com>
        Mod_perl weird behaviour... christian.sylvestre@cetelem.fr
    Re: Need Help with Virtual Avenue <gellyfish@gellyfish.com>
    Re: Opne3 on Win32? Really nobody knows? Or primitive p (elephant)
    Re: Opne3 on Win32? Really nobody knows? Or primitive p <pkotala@logis.cz>
    Re: Perl and MS Access DBs module <rhrh@hotmail.com>
    Re: Perl Database Question <rhrh@hotmail.com>
        Perl Socket Problem <irishcream@iname.com>
    Re: recursive anonymous functions -- problem (Tramm Hudson)
    Re: recursive anonymous functions -- problem (elephant)
    Re: regular expressions with DBI and SQL <rhrh@hotmail.com>
    Re: special case : split this string... (Larry Rosler)
    Re: Stipping HTML and loosing memory <gellyfish@gellyfish.com>
    Re: Testing for the existing of a key in a hash (Abigail)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 22 Jul 1999 16:40:18 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Appending to a file under NT
Message-Id: <MPG.120167de69785431989b6b@news-server>

WeAreScott writes ..
>I moved files from UNIX to NT, and am unable to append to a flat text file i
>have in my cgi-bin directory.

I assume that you mean that you moved (eg) fileX from UNIX to NT .. and 
now

  open( WRITE, ">>fileX") || die $!;
  print WRITE "blah";

doesn't work ?? .. or do you mean you moved the script file ?

>I am almost positive it has to do with the file
>system not recognizing the ">>" in front of the file.txt.

trust me .. it works

when you say that it doesn't work .. what do you mean ? .. because if you 
moved the data files incorrectly then they may have the wrong line 
endings .. and this could cause strange behaviour with the \n pseudo-
character

-- 
 jason - remove all hyphens for email reply -


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

Date: Thu, 22 Jul 1999 11:45:06 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Appending to a file under NT
Message-Id: <7n7hvk$eva6@news.cyber.net.pk>

: >I am almost positive it has to do with the file
: >system not recognizing the ">>" in front of the file.txt.
:
: trust me .. it works
:
: when you say that it doesn't work .. what do you mean ? .. because if you
: moved the data files incorrectly then they may have the wrong line
: endings .. and this could cause strange behaviour with the \n pseudo-
: character

and what about permissions?




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

Date: Thu, 22 Jul 1999 17:38:25 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Appending to a file under NT
Message-Id: <MPG.1201757d564bc330989b6e@news-server>

Faisal Nasim writes ..
>: >I am almost positive it has to do with the file
>: >system not recognizing the ">>" in front of the file.txt.
>:
>: trust me .. it works
>:
>: when you say that it doesn't work .. what do you mean ? .. because if you
>: moved the data files incorrectly then they may have the wrong line
>: endings .. and this could cause strange behaviour with the \n pseudo-
>: character
>
>and what about permissions?

I hadn't thought about that .. I presumed that he's running the perl 
script himself .. and also that if he copied the files there then he'd 
have permissions to them .. but you're right - this is not necessarily 
the case

-- 
 jason - remove all hyphens for email reply -


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

Date: 22 Jul 1999 03:07:47 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Array problem
Message-Id: <slrn7pdk9e.oqh.abigail@alexandra.delanet.com>

Jimtaylor5 (jimtaylor5@aol.com) wrote on MMCLI September MCMXCIII in
<URL:news:19990722004424.05853.00001231@ng-ce1.aol.com>:
|| If someone could help me with this, I'd be grateful. 
|| I want to have an array of information all on one line. I know how to do this
|| when I know how many items there will be, as
|| 
|| ($Item1, $item2, $item3) = split(/\|/,$line);
|| 
|| But I want to add and take away from the array line and there may be 5 or
|| sometimes 6 items. How would I get those items from the array line in my
|| program without knowing how many there are?


The above code doesn't contain any array. If you know what arrays are,
as opposed to lists, the answer suddenly is trivial:

   @array = split /\|/ => $line;



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'##{123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^^^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`1437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y/+{#}$=^*&[0-9]i@:;`"',./ /d)&&$llama."\n");


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Thu, 22 Jul 1999 07:18:23 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: basename regexp?
Message-Id: <3796c567.7032231@news.uniplus.ch>

On Tue, 20 Jul 1999 14:59:36 -0700, "Lauren Smith"
<laurens@bsqaure.com> wrote:

>Perhaps it could be better said:
>$0 =~ /([^\\]+)$/;
>$scriptname = $1;
>print scriptname;
>

Change it to:

m/([^\\\/]+)$/;

This covers / and \

Andreas


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

Date: Thu, 22 Jul 1999 08:27:08 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: basename regexp?
Message-Id: <3796d555.11110836@news.uniplus.ch>

On Thu, 22 Jul 1999 07:18:23 GMT, backwards.saerdna@srm.hc (Andreas
Fehr) wrote:

>
>Change it to:
>
>m/([^\\\/]+)$/;
>
>This covers / and \
>

No MacPerl here :(
I don't know its delimiter.

Andreas


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

Date: Thu, 22 Jul 1999 17:21:46 +0900
From: MLJ <FirstName_LastName@japan.ml.com>
Subject: C++ from perl
Message-Id: <3796D49A.2C1AA0EC@japan.ml.com>

Hi!

I'm trying to link a C++ function from Perl. (I could link a C function
successfully using the help from 'man perlxstut').
For this(C++) I made the necessary  changes in the Makefile concerned (
like, gcc --> g++, etc. ).
The compilations seem to be going smoothly.

But when I run it, it's giving the error message:
  >> Can't find 'boot_Mytest2' symbol in ./blib/arch/Mytest2 ......

Has anyone tried this before? I can send you more details if required (
I admit, it's
quite inadequate).

Any input is welcome.
Thanks in advance.
Bye
Amit




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

Date: Thu, 22 Jul 1999 08:05:25 +0100
From: Alain BORGO <alain.borgo@ratp.fr>
Subject: Re: Difference between Win32::ODBC and Win32::OLE
Message-Id: <3796C2B5.7201B19E@ratp.fr>

Hello,

thank you for helping me.

Martin Atkins a écrit:
>
> I don't know what 'Des erreurs sont survenues' means in English

It means : There is errors.

>, but I can
> make a small suggestion. If you are using ASP, as this post indicates, then
> use the supplied 'server component' for database access rather than the perl
> modules, eg:

That's exactly what I done first but this gave me errors and I change
for PerlScript instead of VB. I then try the Win32::OLE module which
returns the same error as VB. Then I try the module Win32::ODBC which
works fine.

The field that cause problem is LONG (character data of variable
length up to 2 Gb) because VARCHAR2 is limited to 2000 characters
(ORACLE terminology).

It's perhaps a known problem with ODBC (I have the version 2 of ODBC).

Well I thank you again for your answer. I'll keep Win32::ODBC until I
solve this problem.

-- 
A bientôt.
---------------------------------------------------------------------------------
Je ne suis pas sûr d'avoir raison mais je suis sûr d'avoir essayé
d'avoir raison.


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

Date: 22 Jul 1999 01:37:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How do I do a date string (ala from strftime) conversion to time_t?
Message-Id: <slrn7pdevr.oqh.abigail@alexandra.delanet.com>

Gabriel Russell (grussell@hushmail.com) wrote on MMCXLVIII September
MCMXCIII in <URL:news:3793247c.508741461@news.supernews.com>:
;; How do I do a date string (ala strftime) to time (ala gmtime)
;; conversion? I would guess that this is a faq but was unable to find
;; it.


It's in the faq. Grep for unlikely strings like 'Date' and 'Time'.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 22 Jul 1999 08:20:02 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: how to avoid truncation error?
Message-Id: <7n6k7i$dal$1@netnews.csie.NCTU.edu.tw>

hi all,

the following codes have weird result:
@v=(-5.6,-4.0);
$i=1;
$delta=1.6;
print $v[$i]-$v[$i-1],"\n";
print (($v[$i]-$v[$i-1]==$delta)? "yes\n":"no\n");

the first ouput is 1.6, but the second is no
,
so 1.6 is not equal to 1.6($delta)??
I think it is the problem of truncation error.
But how should I make them equal? (get the answer yes!)
thanks.


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

Date: Thu, 22 Jul 1999 08:42:43 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: how to avoid truncation error?
Message-Id: <3796d955.12134398@news.uniplus.ch>

On 22 Jul 1999 08:20:02 GMT, dennis@info4.csie.nctu.edu.tw (GEMINI)
wrote:

>@v=(-5.6,-4.0);
>$i=1;
>$delta=1.6;
>print $v[$i]-$v[$i-1],"\n";
>print (($v[$i]-$v[$i-1]==$delta)? "yes\n":"no\n");
>

Please check, which element in the array has which value...

Amdreas


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

Date: Thu, 22 Jul 1999 08:54:15 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: how to avoid truncation error?
Message-Id: <3796dc00.12817410@news.uniplus.ch>

On Thu, 22 Jul 1999 08:42:43 GMT, backwards.saerdna@srm.hc (Andreas
Fehr) wrote:

>
>Please check, which element in the array has which value...
>
Shame on me, this was my fault...

Andreas


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

Date: Thu, 22 Jul 1999 01:30:28 -0700
From: Mike <mike@customautotrim.com>
Subject: Re: index.cgi script help
Message-Id: <3796D6A4.4918DCC2@customautotrim.com>

Thanks. I'll give it a try.

Mike

--
Custom Auto Trim and Graphics, Inc.
http://customautotrim.com




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

Date: Thu, 22 Jul 1999 08:37:29 GMT
From: christian.sylvestre@cetelem.fr
Subject: Mod_perl weird behaviour...
Message-Id: <7n6l89$m9r$1@nnrp1.deja.com>

Hi! we got a server running mod perl and by looking at our access log we
saw some request listed at night (eventhought this server is not used at
night).

The request line looks like that:

1XX.XXX.XXX.XXX - - [05/Jul/1999:20:17:22 +0200] "HEAD / HTTP/1.0" 200 0

(Where the 1XX.XXX.XXX.XXX correspond to the ip address of this server).

And this occurs every 45 seconds. So, is it mod perl actually requesting
the Header of the doc root every 45 second a normal behaviour?

If not is there any reasons why the server is actually reqyesting itself
the header every 45 seconds ?

Thanks,

Christian Sylvestre


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 22 Jul 1999 09:40:12 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need Help with Virtual Avenue
Message-Id: <3796d8ec@newsread3.dircon.co.uk>

Rich <XXX@hotmail.com> wrote:
> 
>                                          It really sucks that I would
> have to find out by this roundabout way and it wasn't mentioned in any
> of the Virtual Avenue FAQs or my Perl book.
> 

It also really sucks that you didnt care to look at the comprehensive
FAQ that comes with Perl or any of the several thousand posts to this
group on the subject ...

/J\
-- 
"Buzz Aldrin was the second man to walk on the moon and the first to
fill his pants" - Violet Berlin, The Big Bang


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

Date: Thu, 22 Jul 1999 16:27:46 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Opne3 on Win32? Really nobody knows? Or primitive problem?
Message-Id: <MPG.120164ef345fe202989b6a@news-server>

Pavel Kotala writes ..
>I tried to ask yesterday. But I received no answer. Now I don't know, if it
>is because the problem is so difficult or because it is so primitive. So I
>try ask once more. Thank to anybody very much form his time and any answer.

caveat -> I'm no expert .. but the read handle doesn't get an EOF .. 
because there is no EOF sent by commands .. which means that the <> 
operator doesn't become undef .. which means that your $got = <OUT> 
statement never ends (not limited to NT)

so .. you need to have your code respond to the input .. try this code 
out - it may clear up some confusion .. warning .. this contains no error 
handling for open3 - because frankly if I was to guess then it'd probably 
do you more harm than good

#!/usr/bin/perl -w
use strict;
use IPC::Open3;

open3( \*READ, \*WRITE, \*ERR, 'cmd');

print WRITE "dir c:\\\n";

open( OUT, ">test2.txt")  || die "Problem: $!\n";
while (<READ>)
{
  print OUT;
  last
    if /^\s+[\d,]+\sbytes free\s*$/;  # matches the last line of a dir
}
close OUT;
close READ;
close WRITE;
close ERR;
__END__

>Does open3 work on Win32?

yes it does

>If not, has anybody experience how to accomplish this task?

you still might be better off using PGPs options to read and write from 
and to the filesystem .. ie. write your data in a temp file .. and then 
tell pgp (with system('pgp', blah, blah);) to encrypt that file and place 
the output in another file .. then reading that file in

dunno .. depends whether you can find good examples with open3 (I can't) 
and how to handle error conditions etc.

-- 
 jason - remove all hyphens for email reply -


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

Date: Thu, 22 Jul 1999 09:34:47 +0200
From: "Pavel Kotala" <pkotala@logis.cz>
Subject: Re: Opne3 on Win32? Really nobody knows? Or primitive problem?
Message-Id: <932628974.188278@gate.logis.cz>

elephant <e-lephant@b-igpond.com> pí¹e v diskusním
pøíspìvku:MPG.120164ef345fe202989b6a@news-server...
> #!/usr/bin/perl -w
> use strict;
> use IPC::Open3;
>
> open3( \*READ, \*WRITE, \*ERR, 'cmd');
>
> print WRITE "dir c:\\\n";
>
> open( OUT, ">test2.txt")  || die "Problem: $!\n";
> while (<READ>)
> {
>   print OUT;
>   last
>     if /^\s+[\d,]+\sbytes free\s*$/;  # matches the last line of a dir
> }
> close OUT;
> close READ;
> close WRITE;
> close ERR;
> __END__

Thanks very much. Trying this example I receiver message:

C:\WINNT\system32\cmd.exe /c perl -w pipe.pl
Filehandle main::WRITE opened only for input at pipe.pl line 6.
Hit any key to close this window...

So I realized to change order of variables to:

open3( \*WRITE, \*READ, \*ERR, 'cmd');

and program got frozen again. Is is the problem, that I use variables in bad
way? I did not know how else solve the error message problem

Thank You very much once more

Pavel Kotala




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

Date: Thu, 22 Jul 1999 08:24:03 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Perl and MS Access DBs module
Message-Id: <3796C713.ABA8F56A@hotmail.com>

Fredi Agolli wrote:
> 
> Hi to everybody,
> I'm looking for Perl modules which manage MS Access Databases. May you give
> me some information about this?
> 
> Thank's in advance.
> 
> Fredi

Try DBI.pm and DBI::ODBC modules which should be more useful if youre
ever going to use another DB to Access,

Richard H


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

Date: Thu, 22 Jul 1999 08:33:52 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Perl Database Question
Message-Id: <3796C960.3C2485F3@hotmail.com>

Dave Ortman wrote:
> 
> Pardon my seemingly ignorant question,
> 
> I've been given the task of connecting a web site written in Perl to an
> Oracle 8 Database.  I've been looking at various documentation; and
> have found the Oraperl, DBD, and DBI modules.  I was hoping somebody
> could help me understand the difference between these three modules; or
> at least point me in the direction of documentation that might further
> explain the three modules. 

Theres  a FAQ at:
http://www.symbolstone.org/
which should clarify it for you,
forget about Oraperl, its outdated now,

Richard H


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

Date: Thu, 22 Jul 1999 08:34:38 +0200
From: "John" <irishcream@iname.com>
Subject: Perl Socket Problem
Message-Id: <7n6dl0$5ru$1@wanadoo.fr>

The following Perl problem is driving me crazy : I have a script
that opens a socket and communicate with a remote httpd
server. The call to open the socket is :
-------------------------------------------------------------------------
my $sock = IO::Socket::INET->new(PeerAddr => $host,
                                      PeerPort => $port,
                                      Proto    => 'tcp',
                                      Timeout  => 120) || returnError(-2)
-------------------------------------------------------------------------
When this script runs as a shell script, it works great. When
It runs as a CGI, the Socket calls fails and returns the following
error : Error in creating the socket : Protocol not supported
(all parameters are hardcoded in the script, so it is not
a CGI variable problem)

Any idea of why it is happening? Can user priviliges be the
problem (the user executing the shell script is different than
the one running httpd demon)

Note that this happens on a BSD running apache 1.3.1; It
is a virtual server (never got the problem before neither
NT, nor Linux nor Solaris, but all were normal servers
not virtual ones)

Thank you in advance for your help

J




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

Date: 22 Jul 1999 00:26:18 -0600
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: recursive anonymous functions -- problem
Message-Id: <7n6dia$ga5@llama.swcp.com>
Keywords: troll troll troll

[posted and cc'd to cited author, Jason, as well as random folks]

elephant <e-lephant@b-igpond.com> wrote:
> [ item posted to comp.lang.perl.misc and CCed to Tramm Hudson ]

I never received the CC'd copy.  Are you sure?

[snip]
> a precursor .. I wasn't doing it "that way" .. I was correcting someone 
> else's misuse of a my declaration .. "that way" was inherited from them - 
> so perhaps you should CC them

Right, I realized that and was pointing out that your solution
of creating the lexical name before defining the function was
not a "pure functional" design.  You are quite correct that my
flashy and silly method was exactly that.  It has no advantages
from a practical perspective but does demonstrate a useful technique:

	- continuation passing style
	- and tail recursion

I mean, the two useful techniques that it uses are:

	- continuation passing style
	- tail recursion
	- and iterative control structure

Its three, -THREE- powerful techniques are:

	- continuation passing style
	- tail recursion
	- iterative control structure
	- and iterative data structure

Arrgh.  I'll come in again...  Among the interesting, useful and
powerful techniques used are:

	- continuation passing style
	- tail recursion
	- iterative control structure
	- iterative data structure
	- and fancy red uniforms

Nobody expects the functional inquisition!

> the difference in benchmark was fairly trivial .

I am quite suprized that mine performed even reasonably in the benchmark
with the number of function calls that it makes.

> I only 
> ask because your language seems to suggest that this is universally 
> accepted as superior .. why ?

Well, you missed the "X-Troll: Maybe" header.  In an ivory tower
sort of way, yes, my functional design is "superior" since it
demonstrates techniques from later CS courses.

> >So, go study your Friedman books some more and be amazed.
> 
> Friedman books ?

_The Little Lisper_, _Scheme and the Art of Programming_,  _Essentials
of Programming Languages_, etc.  He has written many books on
functional programming and the theory of languages.  

> print "0! = ", $f->(0), "\n";	# prints 0 - oops

Wups.  Uhm.  Ok, here we go:

#!/usr/bin/perl -w
use strict;

my $f = sub { my $a = shift; sub { $a->( $a, my $n = shift, my $r = 1 ) }
}->( sub { $_[1] <= 1 ? $_[2] : ($_[2] *= $_[1]--, goto &{$_[0]}) } );

print "0! = ", $f->(0), "\n";	# 0! = 1
print "7! = ", $f->(7), "\n";	# 7! = 5040
print "9! = ", $f->(9), "\n";	# 9! = 362880

__END__

> let me have a try at a factorial function
> 
> sub factorial
> {
>   my $res = 1;
>   for (1..$_[0]) { $res *= $_ }
>   $res;
> }

Sure, that is an iterative, non recursive function that beats
the pants off of the other ones.  Perl is very slow at calling
functions, so it makes sense that the ones that have O(n) function
calls will be slower than the one that has O(1) function call.

My silly version exhibts iterative control, too -- the call stack
does not grow beyond the O(1) frames.  However, in older versions
of perl your new iterative one might have O(n) space required for
the list of values from 1..$_[0].  I believe that modern perl's
optimize that out.

> jason - remove all hyphens for email reply -

Hmm -- this results in: "jason remove all hyphens for email reply"
which is not a valid address.  What do you mean?

Troll, troll, troll my post,
Tramm
-- 
  o   hudson@swcp.com                 tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.323.38.81   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: Thu, 22 Jul 1999 17:06:05 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: recursive anonymous functions -- problem
Message-Id: <MPG.12016deb1cf1874989b6d@news-server>

Tramm Hudson writes ..
>elephant <e-lephant@b-igpond.com> wrote:
>>...CCed to Tramm Hudson
>
>I never received the CC'd copy.  Are you sure?

quite .. to (checking log) hudson@swcp.com .. I'm sure it'll get there 
eventually

>	- continuation passing style
>	- tail recursion
>	- iterative control structure
>	- iterative data structure
>	- and fancy red uniforms

*8^) .. I'm sure if I'd read any books on recursion then I'd know what 
those terms meant .. I did a semester of programming in a functional 
language called Miranda .. didn't read any of the books though because I 
didn't come across anything that didn't make sense

>Well, you missed the "X-Troll: Maybe" header.

might get kicked out of the newsgroup for this admission .. but in ten 
years on the internet I've never heard that term - nor do I know what it 
means .. X-Troll ?

>In an ivory tower
>sort of way, yes, my functional design is "superior" since it
>demonstrates techniques from later CS courses.

that makes sense .. I didn't see that your tongue was so firmly planted 
in your cheek

>My silly version exhibts iterative control, too -- the call stack
>does not grow beyond the O(1) frames.

actually this probably explains something that I noticed after posting 
which was that with warning on you get the 'deep recursion' warning later 
with your function that with the original .. so certainly that's one 
practical advantage

>> jason - remove all hyphens for email reply -
>
>Hmm -- this results in: "jason remove all hyphens for email reply"
>which is not a valid address.  What do you mean?

yes I know .. to be honest I'm too busy with paying work at the moment to 
bother setting up a sensible spam catcher at the server .. so I just use 
those stupid things .. has dropped my spam from about 40 per day on the 
old email address to only 4 or 5

-- 
 jason - remove all hyphens for email reply -


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

Date: Thu, 22 Jul 1999 08:19:05 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: regular expressions with DBI and SQL
Message-Id: <3796C5E9.C6B5FEAA@hotmail.com>

Faisal Nasim wrote:
> 
> : Is it possible to do the equivalent of the following:
> :
> : select * from [DATABASE] where [THIS FIELD] contains [THIS STRING]
> :
> : in other words, is it possible to select records based on a field value
> : containing a substring using DBI/DBD?
> 
> DBI is not a magic! It can perform on anything which is returned by
> SQL server. And what you want is provided by all SQL servers...
> check out your SQL documentation.
> 
> select * from database where myfiled like 'a%'
> 
> .... just an example (I use mysql)

ditto the above but SQL also provides > WHERE SUBSTR(FIELD,2,3) 
or something like that, look for SUBSTR in your reference

Richard H
or


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

Date: Wed, 21 Jul 1999 23:37:52 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: special case : split this string...
Message-Id: <MPG.12005c1bb770b0b9989d18@nntp.hpl.hp.com>

In article <7n7d09$elf7@news.cyber.net.pk> on Thu, 22 Jul 1999 10:20:08 
+0500, Faisal Nasim <swiftkid@bigfoot.com> says...
 ... 
> &ConvertToArray ( <<EOT )
> ----- Personal Information -----
> <br>Name (First/Last):a
> <br>CompanyName: a
> <br>Street: a
> <br>City: a
> <br>State: a
> <br>Zip: a
> <br>Country: a
> <br>Phone: a
> <br>Fax: a
> <br>Email: a
> <br>
> EOT
> 
> sub ConvertToArray
> {
>     split /\n/ , shift;
> }

Well, if you're going to post actual code (instead of simply pointing to 
the documentation for 'split'), why not post code that:

1.  compiles -- there is no semicolon after the function call.

2.  does something -- the list resulting from the function call is 
neither stored nor used.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 22 Jul 1999 09:37:43 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Stipping HTML and loosing memory
Message-Id: <3796d857@newsread3.dircon.co.uk>

Flint Slacker <flint@tcn.net> wrote:
> 
> The code below seems to strip the HTML tags out but never frees the
> memory.  I searched around and found that it uses a circular list, how
> do I free it?
> 
> sub RemoveHTML {
> 
>         my($htmlref);
> 
>         $htmlref = HTML::FormatText->new;
>         $_[0] = $htmlref->format(parse_html($_[0]));
> 
>         undef $htmlref;		# Free memory ????
> 
>         return($_[0]);
> 
> }
> 

You dont need , infact shouldnt, that undef - as $htmlref is lexically scoped
it will go away when it goes out of scope at the end of the function.

Also I dont think that you want to assign to $_[0] like that as this is an
alias to the *actual* parameter ...

You could simply right your subroutine like this:

sub RemoveHTML
{

   my $htmlref = HTML::FormatText->new;
   
   return $htmlref->format(parse_html(shift));
}

Infact you could have all that as one line but I wont bother you with that.


/J\
-- 
"You've got to remember it was the 1980s. There were a lot of people
alive back then who died in the Second World War" - This Morning with
Richard Not Judy


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

Date: 22 Jul 1999 01:35:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <slrn7pdet7.oqh.abigail@alexandra.delanet.com>

Uri Guttman (uri@sysarch.com) wrote on MMCLI September MCMXCIII in
<URL:news:x71ze1fhyb.fsf@home.sysarch.com>:
## >>>>> "A" == Abigail  <abigail@delanet.com> writes:
## 
##   A> John Borwick (John.Borwick@sas.com) wrote on MMCL September MCMXCIII in
##   A> == I would like to see code where $hash{key} returns "." when $hash{key}
##   A> == undefined.
## 
##   A> sub FETCH {my ($s, $k, $v) = @_ ; exists $s -> {$k} ? $s -> {$k} :
##   A> "."}
## 
## abigail, you are too cute for words.
## 
##   A> This code is free and open software. You may use, copy, modify,
##   A> distribute and sell this code (and any modified variants) in any way
##   A> you wish, provided you do not restrict others to do the same.
## 
## as if anyone would.
## 
##   A> tie my %hash, 'Tie::Silly::Hash';
## 
##   A> print $hash {"larry wall"}, "\n";
## 
## are you saying that larry is equivilent to '.'?


Well, perhaps there is a deeper meaning to my post. But what is it?

   -  There is a Larry present in every dot?
   -  Larry exists, even if he isn't?
   -  Larry Wall! Period!

Or something else? Note that I didn't capitalize his name.....



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

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

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


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