[10809] in Perl-Users-Digest
Perl-Users Digest, Issue: 4410 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 12 17:07:33 1998
Date: Sat, 12 Dec 98 14:00:17 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 12 Dec 1998 Volume: 8 Number: 4410
Today's topics:
Re: a simple puzzle (I suspect) (Ilya Zakharevich)
Re: a simple puzzle (I suspect) <uri@sysarch.com>
Re: array initialisation (Andrew M. Langmead)
Comparing times and dates <agjemmes@extremeonline.com>
Re: Copying files in Perl <gellyfish@btinternet.com>
Disk Libraries/Modules for NT? <pep_mico@hp.com>
Finding what Package my Var is in with Debugger narins@my-dejanews.com
Re: getting http-referer <nospamm@deleteme>
HASH <stmintz@yahoo.com>
Re: HASH <rick.delaney@home.com>
Multidimentional arays??? <tlester@spain.iakom.com>
Re: Multidimentional arays??? <marty@catnmoose.com>
Re: Perl multithread/multiprocess socket server example <gellyfish@btinternet.com>
Re: Script displaying in DOS box on NT server <perlguy@technologist.com>
Re: Script displaying in DOS box on NT server <gellyfish@btinternet.com>
Re: Sorting problem: Is there a better way? <Allan@Due.net>
Re: Splitting a string at a certain point (Craig Berry)
Stripping of the _ <darrensweeney@eswap.co.uk>
Re: Stripping of the _ (Matthew Bafford)
Re: Why Is Perl not a Language? <rick.delaney@home.com>
Re: Why Is Perl not a Language? <flavell@mail.cern.ch>
Re: Why Is Perl not a Language? (Bart Lateur)
Re: Why Is Perl not a Language? (Craig Berry)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Dec 1998 20:40:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: a simple puzzle (I suspect)
Message-Id: <74ukcg$qt8$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ronald J Kimball
<rjk@linguist.dartmouth.edu>],
who wrote in article <1djx59m.1l1en4812dhanoN@bay1-104.quincy.ziplink.net>:
>
> s/$pre\((.*?)\)/$pre(\L$1)/;
>
> In case the parentheses following $pre are empty.
Is it a Unicode addition that one can meaningfully uppercase an empty
string?
Ilya
------------------------------
Date: 12 Dec 1998 15:43:59 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: a simple puzzle (I suspect)
Message-Id: <x7lnkdt7jk.fsf@sysarch.com>
>>>>> "RJK" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:
RJK> Uri Guttman <uri@sysarch.com> wrote:
>> s/$pre\((.+?)\)/$pre(\L$1)/;
RJK> s/$pre\((.*?)\)/$pre(\L$1)/;
RJK> In case the parentheses following $pre are empty.
well, he didn't say that was possible. given the input examples, + seems
like a better choice.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Sat, 12 Dec 1998 18:07:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: array initialisation
Message-Id: <F3v6CF.KMI@world.std.com>
Michael Renshaw <michaelr@lndn.tensor.pgs.com> writes:
>does anyone know how to preallocate an array size within a hash array ?
>i tried doing this:
>$#array{$key} = 100; didnt like it
>but this was OK:
>$#array = 100;
Sometimes the rules for the proper type symbols for complex data
structures can be confusing. One basic rule of references is that you
anywhere you can put an identifier you can a block returning a
reference. Its just in some cases the braces can be omitted. (See the
perlref man page for details.)
Your first try is treated like
{$#array}{$key} = 100;
which is trying to get the length of @array, and then getting the hash
key from it. What you want is:
$#{$array{$key}} = 100;
Take the hash %array, get the reference associated with the key $key,
and preallocate the length of 100.
--
Andrew Langmead
------------------------------
Date: Sat, 12 Dec 1998 22:08:47 +0100
From: "Asbjorn Gjemmestad" <agjemmes@extremeonline.com>
Subject: Comparing times and dates
Message-Id: <74um5o$sl7$1@readme.online.no>
I am trying to create a Perl script that will do the following:
- Read a timeand date variable from a data file (the time HAS to be a single
variable!)
- Read the current time and date, and translate it into the same format as
the time read from the data file.
- Compare the current time/date with the time/date from the data file, and
see how long time there is between them (minutes, hours, days, months).
- Based on wether or not it is is more than x hours/days/months between the
two occurences, a sub procedure is executed.
I hope someone can help me with this, or at least give me a few ideas on
what should be done. An example or two would also be nice, as would a link
to somewhere that will tell me more about this,
Thank you
Asbjorn
------------------------------
Date: 12 Dec 1998 18:22:06 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Copying files in Perl
Message-Id: <74uc8e$1es$1@gellyfish.btinternet.com>
On Sat, 12 Dec 1998 12:05:12 -0400 Bryan Duchesne <crewsys@nbnet.nb.ca> wrote:
> I want to be able to read a file on a local PC and copy a specified file to
> a web directory. The program would be run from a web site with the local
> file name entered in a TEXT box on a form.
>
> Can this be done and if so, how do I reference the local PC file in the Perl
> program? Do I use forward or back slashes in the file path. (I assume it
> has to be / ) ?
>
This is more a general CGI question than a Perl specific one really.
However, If you use the CGI module (which is in more recent distributions or
available ffrom CPAN) you will be able to search the documentation for
'upload' to see how this *might* be done.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 12 Dec 1998 19:47:04 +0100
From: Pep Mico <pep_mico@hp.com>
Subject: Disk Libraries/Modules for NT?
Message-Id: <3672BA28.7FAB08BA@hp.com>
Hello,
Basically for Windows NT environment I'm looking for
any Perl Module that reports this kind of things:
- How many Disks has installed the system?
- How many disk space is used on each disk? Or how many free disk is
available?
I need to do these functions because I want to do a software
installation and I need to know where can I install it, and how many
disk space is available.
These functions will be also be valuable for disk Space Monitoring.
Thanks in advance
pep_mico@hp.com
------------------------------
Date: Sat, 12 Dec 1998 20:54:22 GMT
From: narins@my-dejanews.com
Subject: Finding what Package my Var is in with Debugger
Message-Id: <74ul5u$c15$1@nnrp1.dejanews.com>
My program does _not_ explicitly create multiple packages.
In a subroutine called by another subroutine I set a variable.
In the debugger (which I am finding pretty handy dandy at trying fix up this
other guy's code) if I try
> x $the_var_in_question
I get the correct answer. However, if I try
> x $main::the_var_in_question
I get
undef.
So, my question is how do I figure out what package it is in?
Wish I knew.
Hey, while I'm at it, I'll ask how to pipe the output of a debugger command
to a file, nothing fancy, just something like a complete Var Dump to
~/file_to_look_at_later.
" <- Is one of the only quotes I know, along with -> ' and `
Joshua Narins - UNIX/RDBMS - IMIS/UN DC2-1805-B - 212-963-6911
P.O.Box 20249 narins@un.org
DHCC Home:212-???-????
NY,NY 10017 EY:'881
No opinions expressed reflect those of the United Nations nor part
or parcel there of, except by merry coincidence.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 12 Dec 1998 15:29:05 -0500
From: "marshman" <nospamm@deleteme>
Subject: Re: getting http-referer
Message-Id: <74ujti$7p7$1@camel19.mindspring.com>
$refer = $ENV{'HTTP_REFERER'};
open (LOGFILE, ">> mylog");
print LOGFILE "$refer";
close (LOGFILE);
You should check out file locking (flock)!!!!
marshman
"No quote of the day here!"
FiN wrote in message <3667a732.82046796@news>...
> I have a little problem. I want my index.html page to be able
>to pull the HTTP_REFERER and store it in a text file. My problem is
>how I would go about doing that. How would I be able to run the
>script that would pull who accessed index.html and not the script
>itself. I guess I just need some basic help on how to get the Referer
>off of index.html.
>
> Thanks in advance for the help.
> Finsta@home.com
------------------------------
Date: Sat, 12 Dec 1998 11:59:14 -0600
From: "Sean Mintz" <stmintz@yahoo.com>
Subject: HASH
Message-Id: <74uaiq$hev$1@Masala.CC.UH.EDU>
HI!
I made a program that handles multiple tic-tac-toe games on a server and i
have a question.
It has:
$a1{$cur}
$a2{$cur}
$a3{$cur}
$b1{$cur}
$b2{$cur}
$b3{$cur}
$c1{$cur}
$c2{$cur}
$c3{$cur}
$cur being a game
i need it to update those and this is what i have
$l{$cur} = $move{$cur};
${$l}{$cur} = "X ";
that does not make $l{$cur} "X ";
please help
thanks
Sean Mintz --- stmintz@yahoo.com
------------------------------
Date: Sat, 12 Dec 1998 19:08:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: HASH
Message-Id: <3672C0BE.D572EE8F@home.com>
[posted & mailed]
Sean Mintz wrote:
>
> $l{$cur} = $move{$cur};
>
> ${$l}{$cur} = "X ";
>
> that does not make $l{$cur} "X ";
It is not really clear what you're trying to do. If you want to set
$l{$cur} to "X ", then you would just do so:
$l{$cur} = "X ";
If the value of the scalar variable $l is 'a3' then
${$l}{$cur} = "X "
would set the value of $a3{$cur} to "X ". ${$l} is a symbolic
reference.
You really should not be using symbolic references for these types of
structures, but I get the uncomfortable feeling that that is what you
are trying to do.
You would be better off using multi-dimensional hashes like:
$game{$cur}{a}{1};
$game{$cur}{a}{2};
$game{$cur}{b}{1};
$game{$cur}{b}{2};# etc.
Then you can set moves something like:
$cur = "This game';
$row = 'c';
$column = '3';
$selection = 'X';
$game{$cur}{$row}{$column} = $selection;
perldoc perlref
perldoc perldsc
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 12 Dec 1998 21:28:36 GMT
From: Thomas Lester <tlester@spain.iakom.com>
Subject: Multidimentional arays???
Message-Id: <Pine.GSO.3.96.981212151908.22073B-100000@spain>
Ever book I have that mentions ultidimentional arrays stat "Beyond the
scope of this book". So I could use some instruction. Can someone
explain how to do it in perl.
Just to clarify what I'm wanting to do... like in C creating an array
like:
array[0][1]
array[0][2]
array[1][0]
array[1][1]
etc...
Thanks,
Thomas
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+==+=+=+=+=+=+=+=+=+=+=+=
Thomas Lester UNIX Systems Administrator
tlester@iakom.com http://www.iakom.com
----------------------------------------------------------------------
------------------------------
Date: Sat, 12 Dec 1998 16:44:14 -0500
From: Marty Landman <marty@catnmoose.com>
To: Thomas Lester <tlester@spain.iakom.com>
Subject: Re: Multidimentional arays???
Message-Id: <3672E3AE.5358FBF6@catnmoose.com>
I'm not a C programmer, used to do PL/I and assembler though which have
very different syntaxes from each other and Perl. The Perl syntax for a
multidimensional array is apparently just like C's from what you show
below.
And here's an example:
# from my tic tac toe program
@win[0] = [0,1,2]; # these are row wins
@win[1] = [3,4,5];
@win[2] = [6,7,8];
@win[3] = [0,3,6]; # columnar wins
@win[4] = [1,4,7];
@win[5] = [2,5,8];
@win[6] = [0,4,8]; # diagonal wins
@win[7] = [2,4,6];
so $win[0][1] eq 1 would evaluate as true, as would $win[4][1] eq 4.
hth
p.s. sounds like you might want to get the Camel book, best money i spent
in the past half year.
Thomas Lester wrote:
> Ever book I have that mentions ultidimentional arrays stat "Beyond the
> scope of this book". So I could use some instruction. Can someone
> explain how to do it in perl.
>
> Just to clarify what I'm wanting to do... like in C creating an array
> like:
>
> array[0][1]
> array[0][2]
> array[1][0]
> array[1][1]
> etc...
>
> Thanks,
> Thomas
>
> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+==+=+=+=+=+=+=+=+=+=+=+=
> Thomas Lester UNIX Systems Administrator
> tlester@iakom.com http://www.iakom.com
> ----------------------------------------------------------------------
--
_____ Marty Landman _______ http://www.catnmoose.com/ ______
Living Glass http://www.catnmoose.com/livinglass
Mountain Man http://www.catnmoose.com/mountainman
__________Cat 'n Moose Web Site Design & Development_________
------------------------------
Date: 12 Dec 1998 20:48:20 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl multithread/multiprocess socket server example?
Message-Id: <74ukqk$1fj$1@gellyfish.btinternet.com>
In comp.lang.perl.misc Kyle Cordes <kyle@kylecordes.com> wrote:
> Hi...
>
> I'm looking to build a rather simple server application in Perl. The tricky
> part is that I want it to be a multitasking/threading/whatever server, so
> that each incoming connection spawns another process to handle the request,
> so more than one can be processes concurrently.
>
> I'm thinking that such a thing should already exist, waiting for me to plug in
> my actual service code. However, searching CPAN, DejaNews, etc. has led me
> nowhere.
>
> I have found a few examples of single-threaded servers, always with a note
> that this is a very simple example, and a real app would probably want to be
> able to service more than one request at once.
>
There is an example of a server in the perlipc manpage that uses fork() to
create a new process for each connection. Of course if you are on Win32
then you may not be able to use fork() - threading is still considered an
experimental feature of Perl so you might not want to use that. On Win32
you might be able to use Win32::CreateProcess (or something like that) but
I dont know a great deal about that stuff ...
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 12 Dec 1998 15:05:03 -0600
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Script displaying in DOS box on NT server
Message-Id: <3672DA7F.F6103B61@technologist.com>
Trevor wrote:
>
> Please help!
>
> I've installed Perl32 on an NT server following all the directions, triple
> checked them, but when the script executes, it is displayed in a DOS box
> when executed on the server rather than being sent to the browser. These
> scripts were originally written for and successfully tested on a UNIX
> system. I've even created the most basic "hello world" script and still
> displays in a DOS box.
>
> These same scripts will give a HTTP error 501 when executed across the
> internet.
Something is *still* wrong with your server settings. Which directions
did you follow? ActiveState has some great ones detailing how to set up
the various Windoze servers. You may also need to associate .pl and/or
.cgi to perl...
Good luck,
Brent
--
Java? I've heard of it, it is what I drink while hacking Perl! -me
+----------------------------------------+
| Brent Michalski |
| -- Perl Evangelist -- |
| E-Mail: perlguy@technologist.com |
| Resume: http://www.inlink.com/~perlguy |
+----------------------------------------+
------------------------------
Date: 12 Dec 1998 21:03:42 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Script displaying in DOS box on NT server
Message-Id: <74ulne$1fo$1@gellyfish.btinternet.com>
On Fri, 11 Dec 1998 14:22:03 -0800 Trevor <tdsoft@halcyon.com> wrote:
> Please help!
>
> I've installed Perl32 on an NT server following all the directions, triple
> checked them, but when the script executes, it is displayed in a DOS box
> when executed on the server rather than being sent to the browser. These
> scripts were originally written for and successfully tested on a UNIX
> system. I've even created the most basic "hello world" script and still
> displays in a DOS box.
>
> These same scripts will give a HTTP error 501 when executed across the
> internet.
>
It appears that your server is incorrectly configured to run Perl programs
you probably would be better served asking this question in the newsgroup:
comp.infosystems.www.servers.ms-windows
The instructions how to correctly configure some HTTP servers on NT have
been posted on this group before many times before, however you dont say what
HTTP server you are using so I cant really be more specific - you should
search DejaNews probably to find some answer.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 12 Dec 1998 19:28:36 GMT
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: Sorting problem: Is there a better way?
Message-Id: <74ug54$s7l$0@206.165.167.208>
Tad McClellan wrote in message ...
>Erik de Castro Lopo (please@see.sig) wrote:
>
>: I've got a list of items which are all of the form
>: of one or more alpahbetic charaters followed by
>: one or more digits and I need to sort them. The
>: sorting should be done on the alphabetic part
>: first. If there are two list items with the same
>: alphabetic part they should be ordered on the basis
>: of the size of the numeric part.
>
>: Fortunately I have read the documentation and come
>: up with a working solution but I've been using Perl
>: long enough to know there is a least one more way
>: of doing this and probably even a better way.
>
>: My solution is included after my .sig. Any takers
>: for improvements/other solutions?
>
> Here are some solutions.
>
> I'll leave it to you to decide if any are an "improvement" ;-)
[snip code as it is included below]
> LarryR says he's tired, so we probably won't find out
> which is faster... ;-)
Well, the answer is obvious but I had never done this before and I thought
we had best let Larry rest up for X-mas ;-) As it is my first there are
likely holes in my design and corrective feedback is welcome. The letters
sub makes the leading characters random, while the numbers sub makes them
constant, but with the same number characters. I played with a common seed
value for each subroutine to keep the arrays constant across invocations of
the subs but it did not make any difference.
AmD
Benchmark: timing 1000 iterations of Schwartzian Transform 1, Schwartzian
Transform 2, designated order 1 , designated order 2 ...
Schwartzian Trans 1: 167 wallclock secs (167.25 usr + 0.00 sys = 167.25
CPU)
Schwartzian Trans 2: 137 wallclock secs (136.88 usr + 0.00 sys = 136.88
CPU)
designated order 1 : 356 wallclock secs (356.25 usr + 0.00 sys = 356.25
CPU)
designated order 2 : 352 wallclock secs (352.02 usr + 0.00 sys = 352.02
CPU)
--------------
#!/usr/local/bin/perl -w
use strict;
sub letters {
my @data;
foreach (1..100) {
push (@data,(join "", map {chr(97 +
rand(25))}(1..3)).(int(rand(1000))));
}
return @data;
}
sub numbers {
my @data;
foreach (1..100) {
my $num = rand(25);
push (@data,(join "", map {chr(97 +
$num)}(1..3)).(int(rand(1000))));
}
return @data;
}
sub _designated_order1 {
my @sorted;
my @list = letters();
@sorted = sort designator_order1 @list;
@list = numbers();
@sorted = sort designator_order1 @list;
}
sub _designated_order2 {
my @sorted;
my @list = letters();
@sorted = sort designator_order2 @list;
@list = numbers();
@sorted = sort designator_order2 @list;
}
sub designator_order1 (){
my ($aa, $ba); # alpha parts
my ($an, $bn); # numeric parts
die "'$a' is not a legal value" unless $a =~ /^([a-zA-Z]+)(\d+)$/;
$aa = uc($1);
$an = $2;
die "'$b' is not a legal value" unless $b =~ /^([a-zA-Z]+)(\d+)$/;
$ba = uc($1);
$bn = $2;
return $aa cmp $ba unless $aa eq $ba;
return $an <=> $bn;
}
sub designator_order2 (){
my ($aa, $an) = split /(\d+)/, $a;
my ($ba, $bn) = split /(\d+)/, $b;
$aa = uc($aa);
$ba = uc($ba);
return $aa cmp $ba unless $aa eq $ba;
return $an <=> $bn;
}
sub
rtz_Tran1{
# Schwartzian Transform
my @list = letters();
my @sorted =
map { $_->[0] }
sort { "\U$a->[1]" cmp "\U$b->[1]" || $a->[2] <=> $b->[2]}
map { [$_, (split /(\d+)/)] }
@list;
@list = numbers();
@sorted =
map { $_->[0] }
sort { "\U$a->[1]" cmp "\U$b->[1]" || $a->[2] <=> $b->[2]}
map { [$_, (split /(\d+)/)] }
@list;
}
sub _Swartz_Tran2{
# Schwartzian Transform with comments, read from bottom to top
my @list = letters();
my @sorted =
map { $_->[0] } # return the first of the th
ree elements (orig string)
sort {
"\U$a->[1]" cmp "\U$b->[1]" # ignore case alpha compare
|| # else
$a->[2] <=> $b->[2] # numeric compare
}
map { [$_, (split /(\d+)/)] } # three elements in anon array
# orig string, alpha part, numeric
part
@list;
@list = numbers();
@sorted =
map { $_->[0] } # return the first of the three elements (orig
string)
sort {
"\U$a->[1]" cmp "\U$b->[1]" # ignore case alpha compare
|| # else
$a->[2] <=> $b->[2] # numeric compare
}
map { [$_, (split /(\d+)/)] } # three elements in anon array
# orig string, alpha part, numeric
part
@list;
}
use Benchmark;
#timethese(shift, {
timethese(1000, {
'designated order 1 ' => "srand(100); \&_designated_order1",
'designated order 2 ' => \&_designated_order2,
'Schwartzian Transform 1' => \&_Swartz_Tran1,
'Schwartzian Transform 2' => \&_Swartz_Tran2
});
------------------------------
Date: 12 Dec 1998 18:51:26 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Splitting a string at a certain point
Message-Id: <74udve$5me$1@marina.cinenet.net>
Bart Lateur (bart.lateur@skynet.be) wrote:
: Craig Berry wrote:
:
: > @pieces = $longstring =~ /.{1,20}/g;
:
: I think you forgot the parentheses.
:
: @pieces = $longstring =~ /(.{1,20})/g;
No I didn't. In the absence of parens, /g in a list context captures
(each instance of) the entire match, as if there were parens around the
whole pattern.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "The hills were burning, and the wind was raging; and the
clock struck midnight in the Garden of Allah."
------------------------------
Date: Sat, 12 Dec 1998 12:49:59 -0800
From: "E-swap" <darrensweeney@eswap.co.uk>
Subject: Stripping of the _
Message-Id: <74ukvn$73v@sjx-ixn6.ix.netcom.com>
Hi
I need to know if there is a simple line of code which will allow me to
strip out a _ and replace with a space when I am displaying something. Also
to put it back in if I need to elsewhere.
e.g. how_are_you ... becomes ... how are you and vica versa.
Thanks
Darren
------------------------------
Date: Sat, 12 Dec 1998 16:49:33 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Stripping of the _
Message-Id: <MPG.10dcaefa473a5254989758@news.scescape.net>
In article <74ukvn$73v@sjx-ixn6.ix.netcom.com>, darrensweeney@eswap.co.uk
says...
=> Hi
=>
=> I need to know if there is a simple line of code which will allow me to
=> strip out a _ and replace with a space when I am displaying something. Also
=> to put it back in if I need to elsewhere.
=>
=> e.g. how_are_you ... becomes ... how are you and vica versa.
tr/_/ /;
tr/ /_/;
perldoc perlop
perldoc perlfunc
perldoc perlfaq
=> Thanks
HTH!
=> Darren
--Matthew
------------------------------
Date: Sat, 12 Dec 1998 17:05:56 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Why Is Perl not a Language?
Message-Id: <3672A42C.41B52944@home.com>
[posted & mailed]
Thomas Brian Holdren wrote:
>
> My question is:
> Why is perl not a "programming language"?
Perl is a programming language. See perlfaq1, "Is it a Perl program or
a Perl script?"
Also read q{What's the difference between "perl" and "Perl"?} in the
same document to see why Perl is a programming language and perl is not.
> For example, why is C or BASIC a "programming language", and perl is
> just a "scripting language".
^^^^
I don't think that word belongs there.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 12 Dec 1998 18:17:15 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Why Is Perl not a Language?
Message-Id: <Pine.HPP.3.95a.981212180404.6901B-100000@hpplus01.cern.ch>
On 12 Dec 1998, Thomas Brian Holdren wrote:
> Dear Guru's,
(not a good start...)
> My question is:
> Why is perl not a "programming language"?
Who says it isn't?
If it's any help, I'd be happy to confirm your suspicion that you're
confused. But I'm afraid you begged the question, i.e you assumed the
truth of that which you set out to prove. And since it was wrong,
your question doesn't have an answer.
Perl satisfies all the usual requirements for being called a programming
language. Conditionals and iteration and such.
Perhaps you were misled by the difference between compiled and
interpreted programming languages. But that's far from being a clear
dichotomy either. Or by the fact that Perl started life as an
enhanced shell scripting language.
I'd say just get on and program with it, and stop worrying about this
detail. By the time you've develped the insight to understand the
answer, the question won't really seem important anyway.
p.s don't take this the wrong way: there's nothing wrong with being a
newbie and asking questions, it's a good way to learn.
------------------------------
Date: Sat, 12 Dec 1998 18:09:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Why Is Perl not a Language?
Message-Id: <3672afb3.298023@news.skynet.be>
Thomas Brian Holdren wrote:
>Subject: Why Is Perl not a Language?
Because it's not Chinese? :-)
>I was previously a BASIC programmer (you may snicker),
>and had some shell scripting experience (ksh).
Why should I only snicker about the BASIC?
> My question is:
>Why is perl not a "programming language"?
>
>For example, why is C or BASIC a "programming language", and perl is just a
>"scripting language".
The difference between scripting languages and programming languages is
quite arbitrary. It is definitely NOT about the language's power and
speed.
Some points that may indicate a scripting language:
1) no user interface
2) stored as text, and, at earliest, compiled at startup.
3) used to control other programs (this doesn't apply to Perl)
Bart.
------------------------------
Date: 12 Dec 1998 19:04:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Why Is Perl not a Language?
Message-Id: <74uenb$5me$2@marina.cinenet.net>
Bart Lateur (bart.lateur@skynet.be) wrote:
: The difference between scripting languages and programming languages is
: quite arbitrary. It is definitely NOT about the language's power and
: speed.
Indeed, asking for this difference is a category error, like asking the
difference between elms and trees. Scripting languages are a subset of
interpreted languages, which are themselves a subset of programming
languages; the other major subset of PLs may loosely be called
"(pre)compiled languages." The boundary between these subsets is fuzzy,
and gets fuzzier every day. Where, for example, does one place a
precompiled-to-bytecode language like Java? Like an interpreted language,
it requires a runtime interpreter (the JVM) to execute; like a precompiled
language, it must undergo a separate compilation step, following which it
can be executed endlessly. (And, btw, this isn't new with Java; numerous
compiled BASICs had this property 20 years ago.)
: Some points that may indicate a scripting language:
:
: 1) no user interface
As opposed to what? C? :) What do you mean by a language "having" a UI?
Do you mean an IDE? There are IDEs for Perl, and some of us old fogies
still write C using a text editor and the command line.
: 2) stored as text, and, at earliest, compiled at startup.
Those are good guidelines.
: 3) used to control other programs (this doesn't apply to Perl)
Well, it *can* apply to Perl; Perl is quite good as an "application glue"
language. It's just that Perl can do many other things, as well.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "The hills were burning, and the wind was raging; and the
clock struck midnight in the Garden of Allah."
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4410
**************************************