[7663] in Perl-Users-Digest
Perl-Users Digest, Issue: 1289 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 8 05:07:42 1997
Date: Sat, 8 Nov 97 02:00:29 -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, 8 Nov 1997 Volume: 8 Number: 1289
Today's topics:
Re: Better Way in Perl <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: Better Way in Perl (Abigail)
Re: Chomp vs Chop (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Chomp vs Chop (Jon Orwant)
Re: Chomp vs Chop (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: Chomp vs Chop (Daniel E. Macks)
Re: Chomp vs Chop (Jason Gloudon)
Re: Chomp vs Chop <rra@stanford.edu>
dbm & Perl hash tables <mgallagh@extro.ucc.su.oz.au>
Embedding perl into an MFC application causes memory le <niteowl@hooked.net>
Re: file not found error? (Jason Gloudon)
Re: HELP - deleting an array element out of a "non-asso <rootbeer@teleport.com>
Re: Intricate Sort help needed (Dean Inada)
Re: is it possible to reference a sub-array? (+ questio <markm@nortel.ca>
Re: is it possible to reference a sub-array? <rootbeer@teleport.com>
Re: Newbie Q: Perl @HASH and C Structures <rgm@rtda.com>
Newbie Qu:- NT & Process Ids (Andrew Terry)
Re: One slice of hash, please... <rootbeer@teleport.com>
Re: One slice of hash, please... <markm@nortel.ca>
Re: other language for perl <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
Re: Puzzle: palindromep <rra@stanford.edu>
Re: Regular Expressions (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Re: scalar function weird (Jason Gloudon)
Re: Simple console program george@GDMcClintock.COM
Variable FileHandles <corcordt@cs.purdue.edu>
Re: Variable FileHandles <robert.hughes@amarest.com>
Wrapping of Strings/Lines <ravi@iagnet.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 7 Nov 1997 23:13:53 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Better Way in Perl
Message-Id: <6413dh$oc3@bgtnsc03.worldnet.att.net>
Walker Curtis wrote in message <34639803.A2960A9F@ei.kodak.com>...
<snip>
>The current best here is a 41 character perl hack that I came up with.
>
>perl -e 'for(<*>){`mv $_ $\``if/\.cin$/}'
>
But if you use this, doesn't it change 6.cin.cin to 6.cin, which the rules
say would be a Bad Thing?
I think you'd have to do something like
perl -e"for(<*>){/(\.cin){1}$/&&`mv $_ $\``}"
which is longer but might follow the rules better (assuming it works, which
I haven't checked).
In DOS, where you don't have to worry about .cin.cin or stuff like that, you
could just do
ren *.cin * (11 characters)
but I'll bet that doesn't work in Unix. :D
-- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
------------------------------
Date: 8 Nov 1997 09:02:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Better Way in Perl
Message-Id: <slrn668ap0.kcu.abigail@betelgeuse.wayne.fnx.com>
Creede Lambard ($_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print) wrote on
1530 September 1993 in <URL: news:6413dh$oc3@bgtnsc03.worldnet.att.net>:
++
++ Walker Curtis wrote in message <34639803.A2960A9F@ei.kodak.com>...
++
++ <snip>
++
++ >The current best here is a 41 character perl hack that I came up with.
++ >
++ >perl -e 'for(<*>){`mv $_ $\``if/\.cin$/}'
++ >
++
++
++ But if you use this, doesn't it change 6.cin.cin to 6.cin, which the rules
++ say would be a Bad Thing?
++
++ I think you'd have to do something like
++
++ perl -e"for(<*>){/(\.cin){1}$/&&`mv $_ $\``}"
The {1} is pointless, it still matches foo.cin.cin. If you don't want
to match that, you'd need something else.
Furthermore, you can save chars by using a map:
perl -e'map{`mv $_ $\``if/\.cin$/}<*>'
Or ls, a pipe and -n:
ls|perl -ne'/\.cin$/&&`mv $_ $\``'
Or without perl:
for f in *;do mv $f `basename $f .cin`;done
Or:
ls *|xargs -i mv {} `basename {} .cin`
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^(11+?)\1+$/'
------------------------------
Date: Fri, 07 Nov 97 20:09:32 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Chomp vs Chop
Message-Id: <3463bc84$2$ofn$mr2ice@speaker>
In <ef1046.801.ln@localhost>, on 11/07/97 at 03:33 PM,
tadmc@flash.net (Tad McClellan) said:
+-----
| : "When would ever not know what
| : your chopping off?" I failed to
| : come up with an example and he
| When the $/ special variable (the input record separator) has been set to
| something other than its default of a newline.
+--->8
Or when the last line of the file isn't terminated with a newline.
(Technically also including files ending in e.g. "\n\f", although in most such
cases you'll get the "right" result anyway. At least, as regarded by such a
"guru".)
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
------------------------------
Date: 07 Nov 1997 22:06:38 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: Matt Pezzuto <mpezzuto@link.com>
Subject: Re: Chomp vs Chop
Message-Id: <ORWANT.97Nov7170638@fahrenheit-451.media.mit.edu>
In article <34635299.41C6@link.com> Matt Pezzuto <mpezzuto@link.com> writes:
> My one friend and I got in an
> argument about chomp vs chop.
...
> him. But after thinking for a
> second he replied by saying,
> "When would ever not know what
> your chopping off?" I failed to
> come up with an example and he
> claimed that using chomp was half-hazard
> way of programming because the
> programmer should know whether or
> not an eol is expected to not and
> chop is quicker than chomp because
> it doesn't have to check to make
> sure the last character is an eol.
> I replied with then why did they
> make chomp? I do not totally agree
> with him but I have to admit that
> he has a point. Who is right, the
> newbie or the guru?
Suppose your program is processing a text file and you don't know
whether there's a line terminator at the end of the last line?
Suppose your code needs to remove a line terminator, but can't
be sure that other code hasn't redefined the line terminator with $/ ?
chomp() removes line terminators; chop() removes the last character.
Each has its uses.
-Jon
------------------------------------
Jon Orwant http://tpj.com
Editor & Publisher, The Perl Journal
------------------------------
Date: Fri, 07 Nov 97 22:57:03 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Chomp vs Chop
Message-Id: <3463e375$5$ofn$mr2ice@speaker>
In <ORWANT.97Nov7170638@fahrenheit-451.media.mit.edu>, on 11/07/97 at 10:06
PM,
orwant@fahrenheit-451.media.mit.edu (Jon Orwant) said:
+-----
| Suppose your code needs to remove a line terminator, but can't
| be sure that other code hasn't redefined the line terminator with $/ ?
+--->8
The appropriate answer to that one is ``local($/) = "\n";'', not a comparison
of chomp() vs. chop().
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
------------------------------
Date: 8 Nov 1997 06:39:34 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: Chomp vs Chop
Message-Id: <6411f6$687$1@netnews.upenn.edu>
Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh (bsa@void.apk.net) said:
: In <ORWANT.97Nov7170638@fahrenheit-451.media.mit.edu>, on 11/07/97 at 10:06
: PM,
: orwant@fahrenheit-451.media.mit.edu (Jon Orwant) said:
: +-----
: | Suppose your code needs to remove a line terminator, but can't
: | be sure that other code hasn't redefined the line terminator with $/ ?
: +--->8
:
: The appropriate answer to that one is ``local($/) = "\n";'', not a comparison
: of chomp() vs. chop().
Assuming $/ should be \n. Which isn't always true. Perhaps would be
better practice (which is why I've never worked on a project that
enforced it:) to localize when defining it away from the default, thus
subroutines don't have to guess what the default should have been
before the caller may or may not have changed it.
dan
--
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks
------------------------------
Date: 8 Nov 1997 07:24:42 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Chomp vs Chop
Message-Id: <64143q$23b$2@daily.bbnplanet.com>
Mark Mielke (markm@nortel.ca) wrote:
: faust@wwa.com (Faust Gertz) writes:
: I don't know HOW many people always do it this way. I think several books
: actually document this as acceptable.
: while (<STDIN>) {
: }
This is perfectly acceptable in newer not-as-broken versions of perl
(5.003 does the right thing) since it has been fixed to test
defined($_ = <STDIN>).
: Hmmm... interesting... and what if one of the arguments is a "0"? time to
: stop parsing the rest of the options? :-) nice... the proper way all should
: be doing the above examples are:
: while (defined($_ = <STDIN>)) {
: }
Not neccesary if you upgrade your perl.
Jason Gloudon
------------------------------
Date: 08 Nov 1997 01:36:38 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Chomp vs Chop
Message-Id: <m3k9ej3exl.fsf@windlord.Stanford.EDU>
Daniel E Macks <dmacks@sas.upenn.edu> writes:
> Assuming $/ should be \n. Which isn't always true. Perhaps would be
> better practice (which is why I've never worked on a project that
> enforced it:) to localize when defining it away from the default, thus
> subroutines don't have to guess what the default should have been before
> the caller may or may not have changed it.
That's precisely what should be done.
I personally follow a coding standard where any sub or module that uses
one of Perl's global variables ($_ is the most common, but %SIG comes up
from time to time too and the others less frequently) *always* localizes
it with local() first. subs and modules should not be changing their
parent's environment without a very good reason; it just causes problems
down the road.
It's worth keeping in mind when doing that that for, map, and grep don't
require that $_ be localized since they do it implicitly, but the while
(<HANDLE>) construct does.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sat, 08 Nov 1997 11:31:46 -0800
From: Matthew Gallagher <mgallagh@extro.ucc.su.oz.au>
Subject: dbm & Perl hash tables
Message-Id: <3464BE22.7A77@extro.ucc.su.oz.au>
I'm trying (with alot of problems) to construct a database using Perl
and the standard function build with in "dbm". I'm sure I have to use
has table so I can store the data into the "dbm" can anybody help me
with actually getting the hash table into the "dbm"
Tanks in Advance
------------------------------
Date: Fri, 7 Nov 1997 19:11:13 -0800
From: "Rick" <niteowl@hooked.net>
Subject: Embedding perl into an MFC application causes memory leaks
Message-Id: <640l89$50o$1@its.hooked.net>
Hi,
Im trying to embed the Activestates perl port into a VC++ MFC application
and I have noticed that Im getting a huge list of memory leaks reported by
my debugger upon exit. When I first started this embedding effort I
observed the following linker error message once I changed the build
settings to use the MFC library.
error C2065: 'errno' : undeclared identifier
I traced this back to the fact that MFC undefs errno and redefines it as a
function. I fixed this by placing the following code after the errno undef
in perlexe.cpp
#if (defined(_MT) || defined(_DLL)) && (!defined(_M_MPPC) &&
!defined(_M_M68K))
_CRTIMP int * __cdecl _errno(void);
_CRTIMP unsigned long * __cdecl __doserrno(void);
#define errno (*_errno())
#define _doserrno (*__doserrno())
#else // ndef _MT && ndef _DLL
_CRTIMP extern int errno; // XENIX style error number
_CRTIMP extern unsigned long _doserrno; // OS system error value
#endif // _MT || _DLL
This was some code I found in C library stdlib.h header file. Once I did
this perl.exe built just fine. I left the dll build as a non MFC build. If
I leave perlexe.cpp unchanged except for the one needed change to fix errno,
it seems to run just fine. But as soon as I link any code from the MFC
library strange things happen like the memory leak I mentioned and some
other unexplained intermittent behavior in previously debugged parts of the
app. All I have to do to get this strange behavior is declare a global MFC
class object in perlexe.cpp like this.
CString StringItem;
CString is a MFC string class. As soon as I do this the memory leak starts.
Otherwise they dont exist. This tells me that maybe the code in the MFC
library is somehow interacting with the perl code. But this doesnt make
any since to me at all. Why is it OK when no MFC components are linked and
bogus as soon as I force the compiler to link any MFC code?
Has anyone attempted to embed this perl port into an MFC application and if
successful what did you do to eliminate this strange behavior?
Thanks
Rick Hennegan niteowl@hooked.net
------------------------------
Date: 8 Nov 1997 03:14:58 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: file not found error?
Message-Id: <640lfi$dtr$1@daily.bbnplanet.com>
Brad Bradley (brad.bradley@bridge.bellsouth.com) wrote:
: It looks like the single quotes are what is throwing you off. Perl won't
: interpret any variable stored inside the single quotes, thuis your username
: never gets trenslated during runtime. Try "" to set off the command and you
Wrong. I thought so myself until a few days ago when someone posted and
said otherwise. run the example.
Example:
$joe="double quote value";
print `echo $joe`;
Jason Gloudon
------------------------------
Date: Fri, 7 Nov 1997 17:51:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve Moody <moody@roguewave.com>
Subject: Re: HELP - deleting an array element out of a "non-associative" array
Message-Id: <Pine.GSO.3.96.971107174537.19220B-100000@usertest.teleport.com>
On Fri, 7 Nov 1997, Steve Moody wrote:
> I have a foreach loop stepping through the array when a certain
> condition is reached I want to be able to remove that element currently
> being tested from the array and then proceed with the next element.
Normlly, you shouldn't alter the array you're iterating over.
foreach $item (@list) {
if (something) {
# delete an element from @list -- Bad!
}
}
Instead, one idea would be for you to use the 'next' operator, to simply
skip that item. Or you could use grep to make a list without that item,
then iterate over that.
@newlist = grep { something } @list;
for (@newlist) { ... }
or even
for (grep { something } @list) { ... }
> I already know I could create a new array and "push" the good elements
> onto it, but I was hoping that there was a clever way to just
> remove the element from the current array.
Perl lets you remove an element from a list by using splice. In fact,
through careful use of the three-part for loop and splice, you could even
remove elements from the list you're iterating through - nearly the same
as what I said was so bad above. But the key word is 'careful': It's easy
to make a mistake when doing this, so use caution if you take this route.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 8 Nov 1997 05:46:55 GMT
From: dmi@delta1.deltanet.com (Dean Inada)
Subject: Re: Intricate Sort help needed
Message-Id: <640ucf$791$1@news01.deltanet.com>
Keywords: What to do with Bitwise operators?
In article <slrn65nud6.5a2.tmalloy@boley.escape.com>, <tmalloy@boley.escape.com> wrote:
>Subject: What to do with Bitwise operators?
>Hi. First, I am beginner just learning perl. Can someone provide
>an explaination of the practical use of bitwise operators.
In article <3463975D.F4E539EC@liii.com> "Bruce P. Schuck" <hd-fxsts@liii.com> writes:
>Subject: Intricate Sort help needed
>The need has arisen that at one time, I need to sort this list where the
>section numbers ascend and the sequence numbers ascend; and at another
>time the section numbers ascend, but the sequence descends. The first
>scenario is easy, just sort the hash table and I'd get:
>011001
>011002
>012001
>012002
>012003
>013001
>013002
>*But* I need to easily get this list to sort as:
>011002
>011001
>012003
>012002
>012001
>013002
>013001
>So perhaps someone perhaps knows of a tricky way to do this?
map {$_^"\0\0\0\177\177\177"} sort map {$_^"\0\0\0\177\177\177"}
------------------------------
Date: 08 Nov 1997 01:14:48 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: is it possible to reference a sub-array? (+ question!)
Message-Id: <lq1d8kbq5d3.fsf_-_@bmerhe83.nortel.ca>
Tom Phoenix <rootbeer@teleport.com> writes:
> On 7 Nov 1997, Mark Mielke wrote:
> > function(@ARGV[2..$#ARGV]); # pass array in.
> > or,
> > function( [ @ARGV[2..$#ARGV] ] ); # pass by reference.
> To say that the second is using "pass by reference" is a bit misleading.
> The "reference" in this case is a (Perl) reference to an anonymous
> variable which will likely be destroyed after the function returns. But in
> computer science, the concept of passing data to a function by reference
> means that the function is able to make persistent changes to the
> variables being passed. That happens in the first case, but not in the
> second.
Is there a way then to do the following C code in perl?
void my_function (char **ARGV)
{
printf("%s %s\n", ARGV[0], ARGV[2]);
}
int main (int ARGC, char **ARGV)
{
my_function(&ARGV[1]);
my_function(&ARGV[3]);
}
Calling:
my_program HAVING ANY FUN YET MISTER?
Output:
HAVING FUN
FUN MISTER?
This is what the persons original question was. As you pointed out, my
example doesn't work for "pass by reference" if you wish to modify @ARGV
(something that shouldn't be done anywayz?)
thank ye :-)
mark
-- _________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Northern Telecom Ltd. |
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | Box 3511, Station 'C' |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, ON K1Y 4H7 |
markm@nortel.ca / al278@freenet.carleton.ca |_______________________|
------------------------------
Date: Fri, 7 Nov 1997 18:00:55 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Mielke <markm@nortel.ca>
Subject: Re: is it possible to reference a sub-array?
Message-Id: <Pine.GSO.3.96.971107175600.19220D-100000@usertest.teleport.com>
On 7 Nov 1997, Mark Mielke wrote:
> function(@ARGV[2..$#ARGV]); # pass array in.
>
> or,
>
> function( [ @ARGV[2..$#ARGV] ] ); # pass by reference.
To say that the second is using "pass by reference" is a bit misleading.
The "reference" in this case is a (Perl) reference to an anonymous
variable which will likely be destroyed after the function returns. But in
computer science, the concept of passing data to a function by reference
means that the function is able to make persistent changes to the
variables being passed. That happens in the first case, but not in the
second.
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 07 Nov 1997 17:55:08 -0800
From: Rob Menke <rgm@rtda.com>
To: coyote ghost <zeropage@computek.net>
Subject: Re: Newbie Q: Perl @HASH and C Structures
Message-Id: <3463C67C.7ECC@rtda.com>
If what you're describing is the reading and writing of C structs
directly into a file, you'll find it difficult to do in Perl. However,
the pack/unpack functions, combined with sysread/syswrite, are probably
as close as you would get. Since you are trying to read existing images
generated by a C program, you'll have to figure out how exactly the
bytes are laid out in the struct: the endianness, the alignment, and
such.
------------------------------
Date: Sat, 08 Nov 1997 15:08:02 GMT
From: Andrew@nospam.andyt.demon.co.uk (Andrew Terry)
Subject: Newbie Qu:- NT & Process Ids
Message-Id: <34629dd6.2599235@news.demon.co.uk>
Hello!
Can someone tell me if there is a way to trap a parent process id. I've
figured out that $0 shows me the current id, but if there is a way to
check the id of a process which has called the current process, I could
stop banging my head against this wall.... 8)
By the way, I new to this Perl lark, so go easy on me with the replies!
Cheers
Andrew
------
Andrew@nospam.andyt.demon.co.uk
My email address has been modified to avoid spam mail.
To reply, remove nospam. from my address.
------
------------------------------
Date: Fri, 7 Nov 1997 18:04:44 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mark Mielke <markm@nortel.ca>
Subject: Re: One slice of hash, please...
Message-Id: <Pine.GSO.3.96.971107180110.19220E-100000@usertest.teleport.com>
On 7 Nov 1997, Mark Mielke wrote:
> These are equivalent:
>
> @hash{key1,key2,key3} = (value1, value2, value3);
> ($hash{key1}, $hash{key2}, $hash{key4}) = (value1, value2, value4);
They're not really equivalent, especially if you use -w or 'use strict'.
(Or if four is not equal to three. :-) I think you may have meant to use
this in the first example.
@hash{ qw/key1 key2 key3/ }
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 08 Nov 1997 01:02:06 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: One slice of hash, please...
Message-Id: <lq1en4rq5y9.fsf@bmerhe83.nortel.ca>
Tom Phoenix <rootbeer@teleport.com> writes:
> On 7 Nov 1997, Mark Mielke wrote:
> > These are equivalent:
> > @hash{key1,key2,key3} = (value1, value2, value3);
> > ($hash{key1}, $hash{key2}, $hash{key4}) = (value1, value2, value4);
> They're not really equivalent, especially if you use -w or 'use strict'.
> (Or if four is not equal to three. :-) I think you may have meant to use
> this in the first example.
>
> @hash{ qw/key1 key2 key3/ }
damn... you're right :-)
sorry 'bout that. (and where did that four come from? :-) .)
mark
-- _________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Northern Telecom Ltd. |
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | Box 3511, Station 'C' |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, ON K1Y 4H7 |
markm@nortel.ca / al278@freenet.carleton.ca |_______________________|
------------------------------
Date: Fri, 7 Nov 1997 17:20:55 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/[A-Z]//d>
Subject: Re: other language for perl
Message-Id: <640etd$6i3@news.microsoft.com>
I think this would start with
use swahili;
:D
(Hey, you can do "use english," so why not? :p)
Robert G. Ferrell wrote in message <640ar7$kc8@clarknet.clark.net>...
>In article <34515BDE.7EC1@all-soccer.com>, soccer@all-soccer.com says...
>>I wish to translate my site to another language.
>>Most of the site is html created from perl cgi.
>>
>>Could someone tell me how the process might work?
>
>You need to be just a tad more specific. The only script I saw in a
>brief perusal of your site was continue.pl; is this the one you want to
>convert? Convert to what? Javascript? C++? Java? Why would anyone
>voluntarily abandon Perl for some lesser language? :-)
>
>Robert G. Ferrell
>rferrell@clark.net
>
------------------------------
Date: 08 Nov 1997 01:29:03 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Puzzle: palindromep
Message-Id: <m3oh3v3fa8.fsf@windlord.Stanford.EDU>
Peter Scott <pjscott-remove-to-email@euclid.jpl.nasa.gov> writes:
> This question really made me wish for the "?&" extension [for embedding
> arbitrary code in the middle of a regex]... does any language/utility
> implement that, or did you just make it up?
It's been proposed on perl5-porters and has a fair chance of appearing in
some future version of Perl. I believe Ilya had working patches to at
least partially implement it at some point.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Fri, 07 Nov 97 20:13:53 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Regular Expressions
Message-Id: <3463be1a$3$ofn$mr2ice@speaker>
In <34639E0E.6D5E@southernvirginia.edu>, on 11/07/97 at 06:02 PM,
"Gary C. New" <gnew@southernvirginia.edu> said:
+-----
| > >what if your last name is McBeth, O'Donnell, or Lloyd Webber ?
| > Lettin' [ s/(/w+)/\u\L$1/g ] loose on these, I get:
| > Mcbeth (oops)
| > O'Donnell (ok)
| > Lloyd Webber (ok)
| How would it be possible to write the expression to include names such as
| McBeth also?
+--->8
How do you plan to cope with "van den Wolle" or "de Lint"? (Stoplists won't
work: "de Lint", but "De La Peqa".)
Attempting to "correct" the capitalization of names is a bad idea. If you
insist on consistent capitalization, whack it to *all* uppercase; otherwise,
don't touch it at all.
--
brandon s. allbery [Team OS/2][Linux] bsa@void.apk.net
cleveland, ohio mr/2 ice's "rfc guru" :-) KF8NH
------------------------------
Date: 8 Nov 1997 07:47:56 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: scalar function weird
Message-Id: <6415fc$23b$3@daily.bbnplanet.com>
mehta@mama.indstate.edu wrote:
: #!/usr/bin/perl
: print ">>$/<<\n";
: $/ = "";
: open (IN, "<in.txt") or die "cannot open file in.txt $!\n";
: if (1 == 1) {
: local($all) = scalar (<IN>);
: print "ALL: $all";
: close (IN);
: }
You didn't say what was "weird", or more likely what you don't understand.
Jason Gloudon
------------------------------
Date: Sat, 08 Nov 1997 03:28:00 GMT
From: george@GDMcClintock.COM
Subject: Re: Simple console program
Message-Id: <3463d373.55645033@news.tiac.net>
There are at two pages devoted to "Hello, World" in the UNIX-Haters
Handbook (BASIC, Pascal, Lisp, C, C++) by Garfinkel et. al.
G
On 4 Nov 1997 14:10:14 GMT, on.maps.barker@cix.co.uk (Pete Barker)
wrote:
>In article <63jbe2$5o1@bgtnsc03.worldnet.att.net>,
>BBDOG@worldnet.att.net (Al) wrote:
>
>> Can someone please send me a sample perl source code for a DOS
>console
>> program that says "Hello!". I want to compare different
>programming
>> languages. Email to BBDog@worldnet.att.net.
>>
>>
>
>You can't compare different programming languages just from
>something that says "Hello!"? Some programming languages are
>better at things than others, and it therefore depends on what you
>want to do!
>
>Anyway, its...
>
>print "Hello!";
>
>Pete Barker
>P.S. Please remove on.maps. to mail me.
>
------------------------------
Date: Fri, 07 Nov 1997 22:49:33 -0500
From: David Corcoran <corcordt@cs.purdue.edu>
Subject: Variable FileHandles
Message-Id: <3463E14D.BAD@cs.purdue.edu>
I'm trying to write a sockets module for a specific job at work
and was curious if someone knew how to create a variable FileHandle.
Currently I have a
$remote = accept(TMP,SOCK);
$users[$i++] = */TMP;
I have also done $foo = new FileHandle;
but don't know how to print to $foo.
I would like to be able to select that handle to print to
such as a print {$users[$i++]} "Welcome to port xxx.\n";
Does anyone know how to go about this ????
Thanks
Dave
------------------------------
Date: Fri, 07 Nov 1997 23:16:54 -0800
From: Robert Hughes <robert.hughes@amarest.com>
To: corcordt@cs.purdue.edu
Subject: Re: Variable FileHandles
Message-Id: <346411E6.6DE6A902@amarest.com>
David Corcoran wrote:
> I'm trying to write a sockets module for a specific job at work
> and was curious if someone knew how to create a variable FileHandle.
>
> Currently I have a
>
> $remote = accept(TMP,SOCK);
> $users[$i++] = */TMP;
>
> I have also done $foo = new FileHandle;
try the newer module 'IO::Handle' if you have it.
>
>
> but don't know how to print to $foo.
print $foo "bar";
>
>
> I would like to be able to select that handle to print to
> such as a print {$users[$i++]} "Welcome to port xxx.\n";
>
> Does anyone know how to go about this ????
>
> Thanks
> Dave
Enjoy,
Robert
------------------------------
Date: Fri, 07 Nov 1997 15:34:01 -0500
From: Ravi Pina <ravi@iagnet.net>
Subject: Wrapping of Strings/Lines
Message-Id: <34637B39.794BDF32@iagnet.net>
I have a string that I'd like to insert a \n every, n characters. Is
there an easy way of doing this?
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1289
**************************************