[7586] in Perl-Users-Digest
Perl-Users Digest, Issue: 1212 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 22 08:28:12 1997
Date: Wed, 22 Oct 97 05:00:51 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 22 Oct 1997 Volume: 8 Number: 1212
Today's topics:
Re: 2000 time problem <seay@absyss.fr>
Bit Shifting in Perl <ytu@scudc.scu.edu>
Re: Bit Shifting in Perl <rootbeer@teleport.com>
Re: Bit Shifting in Perl <sbekman@iil.intel.com>
Re: catching exit() within eval() ??? <joshb@kadence.kom>
Re: catching exit() within eval() ??? <seay@absyss.fr>
Children becoming ZOMBIE if parent still alive? dsalch@liberty.com
Re: Children becoming ZOMBIE if parent still alive? (David Goh)
Re: Children becoming ZOMBIE if parent still alive? (Toutatis)
DOS perl serial simple I/O (Me)
Re: DOS perl serial simple I/O (Ilya Zakharevich)
FileHandle on NT <qdtjasv@toedt.ericsson.se>
Re: help solving this beginning 'perl' program (Nem W Schlecht)
Re: help solving this beginning 'perl' program (brian d foy)
Re: help solving this beginning 'perl' program <ase@seanet.com>
Re: help solving this beginning 'perl' program (Toutatis)
How to set perl via Fastrack Server <adm_bbl@mozart.inet.co.th>
Learning Perl... best way? <lee.davies@NOSPAMmicrotest.co.uk>
Re: Learning Perl... best way? (Mike Stok)
Re: Looking for an authentication admin CGI named "Luci (brian d foy)
Re: mkdir? (Nem W Schlecht)
Re: Need help - Text formatting problems (brian d foy)
Perl and HTML in one file ? (Kai Birger Nielsen)
perl editor <afan@elnet.msk.ru>
Re: perl editor <seay@absyss.fr>
Perl Novice need info (Maurizio Coppari)
Perl Pad function (George Pieri)
Question: Using Modules (Robert Nagy)
Re: Un-require lib files <seay@absyss.fr>
Why doesn't this work? (Gerben Wierda)
WWW::Search and AltaVista (Kou Sato)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 22 Oct 1997 11:30:55 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: 2000 time problem
Message-Id: <344DC7CF.57420BF0@absyss.fr>
John Moreno wrote:
>
> But when this does start to happen I hope that the people designing this
> data type set a better X than either 1904 or 197(?) - one that goes back
> a little farther for people doing historical work.
This doesn't scale too far back, as the fundamental calendar has changed
several times in the past few thousand years (not to mention that not
everyone uses this calendar). Remember that not everyone adopted the
Gregorian Calendar at the same time (this is why George Washington has
two possible values for his birthday: the English adopted the Gregorian
Calendar while Georgie was alive). You might have to pick a single place
(Rome, Athens, Bejing, Jerusalem, whatever) and use it as _the_ calendar
and treat all the others as variations of this one calendar. Working
with this calendar differences is OK for us humans, but not obvious for
computers.
I don't see any scheme which will work for all cases. I'd like to
switch 1970 to 2000 (ouch, that'll hurt) and just use that as a baseline
and allow negative values. It won't be any easier to use than the 1970
base of today, but it will be a whole lot easier to explain to people.
- doug
------------------------------
Date: Tue, 21 Oct 1997 16:58:07 -0700
From: Kitty Tu <ytu@scudc.scu.edu>
Subject: Bit Shifting in Perl
Message-Id: <344D418E.AB1CD98C@scudc.scu.edu>
Hi,
I am trying to do the bit shifting of a scalar variable (which actually
contains one char) in Perl. And it always returns 0 back. Can somebody
tell me exactly how to do the bit shifting if the variable does not
contain a number? Or can it be done at all?
Thanks in advance!!
Kitty Tu
------------------------------
Date: Tue, 21 Oct 1997 19:29:55 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Kitty Tu <ytu@scudc.scu.edu>
Subject: Re: Bit Shifting in Perl
Message-Id: <Pine.GSO.3.96.971021192905.13354J-100000@usertest.teleport.com>
On Tue, 21 Oct 1997, Kitty Tu wrote:
> I am trying to do the bit shifting of a scalar variable (which actually
> contains one char) in Perl. And it always returns 0 back. Can somebody
> tell me exactly how to do the bit shifting if the variable does not
> contain a number? Or can it be done at all?
The methods in perlop(1) should work for you; if they don't, could you
please post some code which doesn't do what you expect? Then we can help
you to change your expectations. :-) Thanks!
--
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: Wed, 22 Oct 1997 13:06:50 +0200
From: Stas <sbekman@iil.intel.com>
Subject: Re: Bit Shifting in Perl
Message-Id: <344DDE4A.73498446@iil.intel.com>
Kitty Tu wrote:
>
> Hi,
>
> I am trying to do the bit shifting of a scalar variable (which actually
> contains one char) in Perl. And it always returns 0 back. Can somebody
> tell me exactly how to do the bit shifting if the variable does not
> contain a number? Or can it be done at all?
>
> Thanks in advance!!
>
> Kitty Tu
try the Bit::Vector package from CPAN by Steffen Beyer <sb@sdm.de>
=====================================
Package "Bit::Vector" Version 5.0
=====================================
for Perl version 5.000 and higher
It is available from http://www.engelschall.com/u/sb/download/ or from
any CPAN ftp server (look for "Bit-Vector-5.0b1.tar.gz").
------------------------------
Date: Tue, 21 Oct 1997 22:34:43 -0700
From: "Josh Baudhuin" <joshb@kadence.kom>
Subject: Re: catching exit() within eval() ???
Message-Id: <62k3hj$mtg$1@news.cadence.com>
Maybe you could override the declaration of exit()?
Christian Mallwitz wrote in message <344D369D.83319413@intershop.de>...
>Hi folks,
>
>I want to catch a call to exit() within a eval(). The code in eval is
actually a
>require(something) and I can't change "something"
>
>Here is was I tried:
>
>eval "exit;";
>warn "outside: [$@]" if $@;
>print "finishing ...";
>END { print "within END block\n"; }
>
>As expected the END block is executed but not the print statement.
>
>Is there any work around ?
>
>Thanks a lot
>Christian
------------------------------
Date: Wed, 22 Oct 1997 11:40:44 +0200
From: Doug Seay <seay@absyss.fr>
To: Christian Mallwitz <mallwitz@intershop.de>
Subject: Re: catching exit() within eval() ???
Message-Id: <344DCA1C.94B69D2@absyss.fr>
[[posted and mailed]
Christian Mallwitz wrote:
>
> Hi folks,
>
> I want to catch a call to exit() within a eval(). The code in eval is actually a
> require(something) and I can't change "something" :-(
>
> Here is was I tried:
>
> eval "exit;";
> warn "outside: [$@]" if $@;
> print "finishing ...";
> END { print "within END block\n"; }
>
> As expected the END block is executed but not the print statement.
>
> Is there any work around ?
>From "perldoc -f exit"
=item exit EXPR
Evaluates EXPR and exits immediately with that value. (Actually, it
calls any defined C<END> routines first, but the C<END> routines may not
abort the exit. Likewise any object destructors that need to be called
are called before exit.) Example:
$ans = <STDIN>;
exit 0 if $ans =~ /^[Xx]/;
See also die(). If EXPR is omitted, exits with 0 status. The only
universally portable values for EXPR are 0 for success and 1 for error;
all other values are subject to unpredictable interpretation depending
on the environment in which the Perl program is running.
You shouldn't use exit() to abort a subroutine if there's any chance
that
someone might want to trap whatever error happened. Use die() instead,
which can be trapped by an eval()
=cut
exit() is fatal. period. you can try launching a child process and let
it do the dirty work. If it returns 0, then the main process can do its
own require, otherwise it flags the error. Ugly as sin, eh?
Why can you not change "something"? Policy?
- doug
------------------------------
Date: 21 Oct 97 18:15:54 GMT
From: dsalch@liberty.com
Subject: Children becoming ZOMBIE if parent still alive?
Message-Id: <344cf15a.0@news.liberty.com>
Keyword:
I am working on a program that launches children that run an indetermined amount of time
and then exit normally, but the parent runs forever, launching
children as needed to do certain tasks. The problem is that when the children
die they go into zombies until the parent dies, which normally would
be never. I have tried killing the processes form the parent,
forking children of children, etc. and nothing works without leaving
some zombie running somewhere.
What am I missing?
Dave
dsalch@liberty.com
------------------------------
Date: 22 Oct 1997 07:10:36 GMT
From: david@unico.com.au (David Goh)
Subject: Re: Children becoming ZOMBIE if parent still alive?
Message-Id: <62k8tc$hud@padre.unico.com.au>
In comp.lang.perl.misc, on 21 Oct 97 18:15:54 GMT
dsalch@liberty.com <dsalch@liberty.com> wrote:
>I am working on a program that launches children that run an indetermined amount of time
>and then exit normally, but the parent runs forever, launching
>children as needed to do certain tasks. The problem is that when the children
>die they go into zombies until the parent dies, which normally would
>be never. I have tried killing the processes form the parent,
>forking children of children, etc. and nothing works without leaving
>some zombie running somewhere.
>
>What am I missing?
Dead processes go zombie until their parent does a wait(2) syscall,
in order to retrieve the status of the exited child.
When your parent process dies, your zombie children are inherited by init,
which does wait(2) to see if it needs to be respawning processes, so
the zombies disappear then.
You can wait(2) from your parent perl program by using the wait or
waitpid functions, which are described in perlfunc(1).
Later,
David
--
Unico Computer Systems Pty Ltd
David Goh Software Engineer
david@unico.com.au (03) 9866 5688
------------------------------
Date: 22 Oct 1997 10:09:12 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: Children becoming ZOMBIE if parent still alive?
Message-Id: <toutatis-ya023180002210971209150001@news.euro.net>
In article <344cf15a.0@news.liberty.com>, dsalch@liberty.com wrote:
> Keyword:
>
> I am working on a program that launches children that run an indetermined
amount of time
> and then exit normally, but the parent runs forever, launching
> children as needed to do certain tasks. The problem is that when the children
> die they go into zombies until the parent dies, which normally would
> be never. I have tried killing the processes form the parent,
> forking children of children, etc. and nothing works without leaving
> some zombie running somewhere.
According to Sriram Srinivasan in "Advanced Perl Programming",
$SIG{CHLD} = sub {wait ()};
in your code should do what you want.
--
Toutatis
------------------------------
Date: Tue, 21 Oct 1997 08:40:16 GMT
From: jcm@oip.be (Me)
Subject: DOS perl serial simple I/O
Message-Id: <344c68a1.6544650@194.7.3.14>
Hi,
is there anybody out here using only perl4
that ever accessed the serial port ?
I am familiar with plain perl processing, but not with port access ...
can someone give me a clue ?
I would like to grab the chars that a serial device (take e.g. a
modem) replies to a simple command
e.g. perl sends on com2: "at$h\n"
perl shows on the screen that com2 (the modem) replied with
"help1 type at$h1\n"
what simple perl lines would do this ?
I suppose something like
$inp = <COM2:;
$out = >COM2:;
$command="AT$h";
...
should do, but i don't have a clue
I think since in dos a serial port or parallel port can be accessed
with a pseudo-file (lpt1:, com1:, ...) this is the way, nut who am i
..
Thanks in advance for any suggestion
jcm@oip.be <---------------------------
------------------------------
Date: 22 Oct 1997 11:26:41 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: DOS perl serial simple I/O
Message-Id: <62knth$fbo$1@agate.berkeley.edu>
In article <344c68a1.6544650@194.7.3.14>, Me <jcm@oip.be> wrote:
> Hi,
> is there anybody out here using only perl4
> that ever accessed the serial port ?
>
> I am familiar with plain perl processing, but not with port access ...
> can someone give me a clue ?
Use syswrite and sysread(char-by-char), or use an appropriate ioctl
(or is it fcntl? - look in the docs for the runtime library) to access
the number-of-pending-chars field, and use it in sysread().
Ilya
------------------------------
Date: Wed, 22 Oct 1997 12:41:12 +0200
From: Jan Svensson TO/EDT/T/DX <qdtjasv@toedt.ericsson.se>
Subject: FileHandle on NT
Message-Id: <344DD848.5D48@toedt.ericsson.se>
I have written a fairly large system where I use FileHandle a lot.
When moving to NT i discovered that full paths in NT, beginning
with a volume name, e.g. 'C:', is prepended with './'.
This behaviour is suggested in the FAQ but, as said, don't work for NT.
The options I see is replacing FileHandle with 'normal' file operations
(at a considerable cost) or make my own patched copy of FileHandle.
Is there any other way to solve the problem or is it a bug I have to
live with?
------------------------------
Date: 21 Oct 1997 20:56:03 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: help solving this beginning 'perl' program
Message-Id: <62jmfj$kas@abattoir.cc.ndsu.nodak.edu>
[courtesy copy e-mailed to author(s)]
In comp.lang.perl.misc, Joyce Koontz <JKOONTZ@dts.harris.com> wrote:
>Here is the question:
>
>Write a "Perl" program that takes as input a momth and day, sucn as
>"Dec 31".
>The program should return what day of the year it is. Thus, "Jan 1"
>should return 1, "Dec 31" should return 365 (you can assume February
>has 28 days).
Hm... the UNIX 'date' command already does this:
date "+%j"
I'm sure that the Date::Manip Perl package will help you a lot. Do a
DejaNews search for 'julian' and 'date' and I'm sure you'll find what
you're looking for.
--
Nem W Schlecht nem@plains.nodak.edu
NDUS UNIX SysAdmin http://www.nodak.edu/~nem
"Perl did the magic. I just waved the wand."
------------------------------
Date: Tue, 21 Oct 1997 23:17:12 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: help solving this beginning 'perl' program
Message-Id: <comdog-ya02408000R2110972317120001@news.panix.com>
In article <344D29C9.4F86@dts.harris.com>, Joyce Koontz <JKOONTZ@dts.harris.com> wrote:
>Here is the question:
>
>Write a "Perl" program that takes as input a momth and day, sucn as
>"Dec 31".
>The program should return what day of the year it is. Thus, "Jan 1"
>should return 1, "Dec 31" should return 365 (you can assume February
>has 28 days).
that's not a question. it's an imperative followed by a statement.
juxtaposed they sound like a product specification or a homework
assignment. ;)
you might want to check out CPAN's [1] collection of nifty date
manipulation thingys. if you get stuck along the way, you might
try posting a specific question.
good luck :)
[1]
Comprehensive Perl Archive Network
find one at <URL:http://www.perl.com>
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 21 Oct 1997 21:04:57 -0700
From: "Allen Evenson" <ase@seanet.com>
Subject: Re: help solving this beginning 'perl' program
Message-Id: <62ju0e$odt@q.seanet.com>
=20
Joyce Koontz wrote in article <344D29C9.4F86@dts.harris.com>...
>Here is the question:
>
>Write a "Perl" program that takes as input a momth and day, sucn as=20
>"Dec 31".
>The program should return what day of the year it is. Thus, "Jan 1"
>should return 1, "Dec 31" should return 365 (you can assume February
>has 28 days).
>
>You may want to allow the use of full month names such as "January 28".
Here's two of the many ways to do it: Neither has error checking or any =
other=20
decorations. Both assume month and day are passed on the command line =
and
print the result to STDOUT.
1st way using Date::Calc and Date::CalcLib modules (available at =
www.perl.com/CPAN)
#!/usr/bin/perl -w
use Date::DateCalc qw(calc_days);
use Date::DateCalcLib qw(decode_date_us);
$usdatestr =3D join(" ",@ARGV) . "1997"; #change year to suit
my ($year, $mm, $dd) =3D decode_date_us($usdatestr);
$days =3D calc_days($year,$mm,$dd) - calc_days(1997,1,1) + 1; #change =
year to suit
print "Date Module: ",$days," since Jan 1\n";
2nd way using our own hash
#!/usr/bin/perl -w
dayofyear($ARGV[0],$ARGV[1]);
sub dayofyear {
my ($month, $day)=3D @_;
my %months2days =3D(
'jan' =3D> 0, # 31
'feb' =3D> 31, # 28
'mar' =3D> 59, # 31
'apr' =3D> 90, # 30
'may' =3D> 120, # 31
'jun' =3D> 151, # 30
'jul' =3D> 181, # 31
'aug' =3D> 212, # 31
'sep' =3D> 243, # 30
'oct' =3D> 273, # 31
'nov' =3D> 304, # 30
'dec' =3D> 334, ); # 31=3D364
$month =3D~ s/^(\w{3}).*/\l$1/i;
$days =3D $months2days{$month} + $day;
print "$days since Jan 1\n";
}
HTH, (Remember: TMTOWTDI)
------------------------------------------
Allen
------------------------------
Date: 22 Oct 1997 10:17:02 GMT
From: toutatis@_SPAMTRAP_toutatis.net (Toutatis)
Subject: Re: help solving this beginning 'perl' program
Message-Id: <toutatis-ya023180002210971217050001@news.euro.net>
In article <62ju0e$odt@q.seanet.com>, "Allen Evenson" <ase@seanet.com> wrote:
> HTH, (Remember: TMTOWTDI)
Eh...
Happy Time Hacking,
? ? ? Of Ways To Do It
Help me out
--
Toutatis
------------------------------
Date: Wed, 22 Oct 1997 16:01:43 +0700
From: Adm_bbl <adm_bbl@mozart.inet.co.th>
Subject: How to set perl via Fastrack Server
Message-Id: <344DC0F5.2E110B69@mozart.inet.co.th>
Hello
I want to know ,How to install perl on windows95 to work with Netscape
Fastrack Server 2.0(for win95)
Thanks for your assistance
Cameru.
------------------------------
Date: Wed, 22 Oct 1997 08:48:12 +0100
From: "Lee Davies" <lee.davies@NOSPAMmicrotest.co.uk>
Subject: Learning Perl... best way?
Message-Id: <877506644.27322.0.nnrp-01.9e98f2d6@news.demon.co.uk>
My company launched our new web site just before Christmas of last year and
we have been happily plodding along with HTML and Javascript.
We now want to do more with our site as we have commercial space and have
our own cgi-bin.
So... any recommendations on the best way to learn Perl? My background is
in Unix programming using C, C++ and shell scripting so I'm fairly ok with
the Perl scripts I have looked at so far, I just need some guidance...
All replies much appreciated, although e-mail's would be best.
Thanks.
lee.davies@microtest.co.uk
------------------------------
Date: 22 Oct 1997 11:11:52 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Learning Perl... best way?
Message-Id: <62kn1o$2tu@news-central.tiac.net>
In article <877506644.27322.0.nnrp-01.9e98f2d6@news.demon.co.uk>,
Lee Davies <lee.davies@NOSPAMmicrotest.co.uk> wrote:
>My company launched our new web site just before Christmas of last year and
>we have been happily plodding along with HTML and Javascript.
>
>We now want to do more with our site as we have commercial space and have
>our own cgi-bin.
>
>So... any recommendations on the best way to learn Perl? My background is
>in Unix programming using C, C++ and shell scripting so I'm fairly ok with
>the Perl scripts I have looked at so far, I just need some guidance...
>
>All replies much appreciated, although e-mail's would be best.
You can try and get the second edition of Learning Perl by Randal Schwartz
and Tom Christiansen as a useful tutorial and Programming Perl by Larry
Wall, Randal Schwartz and Tom Christiansen. Both are published yb
O'Reilly and Associates,
http://www.oreilly.com/publishing/perl/products.htm is a place to start
looking for ISBN numbers etc. Also there are Tom Christiansen's book
reviews (maybe a little biassed ;-) at
http://language.perl.com/critiques/index.html
The on-line docs provided with recent perls are pretty comprehensive, but
a tutorial such as Learning Perl probably primes you to make better use of
them. Ther is also the FAQ, check out the link off http://www.perl.com/
which is worth reading through even if it doesn't seem to make sense at
first... it'll save time later.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Tue, 21 Oct 1997 23:13:22 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Looking for an authentication admin CGI named "Lucien"
Message-Id: <comdog-ya02408000R2110972313220001@news.panix.com>
In article <spamnotmax_eper-2110971330310001@ts011d17.min-mn.concentric.net>, spamnotmax_eper@hotmail.com (Steve S) wrote:
>I'm looking for a cgi named "Lucien" that's used for administering the
>password file with auth-lib.pl (from Selena Sol). It was written by Leslie
>Orchard.
>
>It was at: http://www.industrynet.net/lorchard/cgi/ titled Talien's CGI
>Dreams, but the link is stale. Anyone know where to find it?
strangely enough, searching for "Talien" in Alta Vista brought that
link up at the top the search results. i went, i saw, i downloaded.
perhaps you should try again. seems you won't be getting this the
complimentary email with this though...
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 21 Oct 1997 20:37:43 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: mkdir?
Message-Id: <62jld7$jok@abattoir.cc.ndsu.nodak.edu>
[courtesy copy e-mailed to author(s)]
In comp.lang.perl.misc, Randal Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Tim" == Tim Meals <tamino@rebis.com> writes:
>
>Tim> mkdir($directory,"0776");
>Tim> mkdir($directory,"ug+rwx,o+rx");
>Tim> mkdir($directory,"00776");
>Tim> mkdir($directory,"776");
>
>You're gonna scream:
> mkdir $dir, 0776;
>
>Or, equivalently:
> mkdir $dir, oct("776");
>
>When Perl is looking at a string, it's *never* octal unless you tell
>it specifically.
Randal, JAPH, setting 'em straight. ;-)
Althought there is another problem. From the original post:
>I get different results with each one, but non give the permissions I
>want, "drwxrwxr-x". Please help out with this simple little statement
^^^^^^^^^^
The permissions to get this are 775, not 776.
776 would be "drwxrwxrw-"
r - 4
w - 2
x - 1
--
Nem W Schlecht nem@plains.nodak.edu
NDUS UNIX SysAdmin http://www.nodak.edu/~nem
"Perl did the magic. I just waved the wand."
------------------------------
Date: Tue, 21 Oct 1997 23:03:28 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need help - Text formatting problems
Message-Id: <comdog-ya02408000R2110972303280001@news.panix.com>
In article <344e1009.7148378@news.wwa.com>, faust@wwa.com wrote:
>On Tue, 21 Oct 1997 11:49:25 -0600, eric@jmfilm.com (Eric Broach)
>wrote:
>>How do you take a text string, assigned to a variable, and strip the
>>returns out of it?
>
>I would do it like this.
>
> $value =~ tr/\015\012//d;
the trick is not to run two line into each other in the process
(run on sentences for the digital age) :)
#!/usr/bin/perl
$string=<<'HERE';
This is line one
This is line two
HERE
$string =~ tr/\r\n//d;
print $string;
__END__
This is line oneThis is line two
you might consider replacing returns and newlines with a single
space, and then deal with multiple spaces later.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 22 Oct 1997 07:19:52 GMT
From: bnielsen@daimi.aau.dk (Kai Birger Nielsen)
Subject: Perl and HTML in one file ?
Message-Id: <62k9eo$2i1$1@nf.aau.dk>
I have a bit silly question. I want to present a Perl script as
a web page, but that's too easy: enclose in <pre> </pre> and use
< > for the < and > that occurs. So I want something a
bit more tricky. A file that is both vanilla html and perl and
preferably the html should display as the perl script when viewed
through a browser, maybe with a comment that you need to say
perl -blah -blahblah to make it run.
Since the first line in a perl program is something like
#!/usr/local/bin/perl -w
and the first line in a html file is something like
<html>
it seems impossible, but that can't be true since you can do
everything in Perl, so I imagine that some of the gurus can
come up with an incantation for making an html file into something
perlish. My best bet would be something that took the file
and converted all < into # and ran it through eval, but maybe
someone here can come up with something better ?
Regards
--- Birger Nielsen (bnielsen@daimi.aau.dk)
------------------------------
Date: Wed, 22 Oct 1997 10:29:19 +0300
From: Vladimir Afanasiev <afan@elnet.msk.ru>
Subject: perl editor
Message-Id: <344DAB4F.5578A2E3@elnet.msk.ru>
Where I can download freeware or shareware editor for PERL program
(Win'95)?
Reply via email please.
--
Vladimir
http://www.ipclub.ru
------------------------------
Date: Wed, 22 Oct 1997 12:01:20 +0200
From: Doug Seay <seay@absyss.fr>
To: Vladimir Afanasiev <afan@elnet.msk.ru>
Subject: Re: perl editor
Message-Id: <344DCEF0.2A258BCF@absyss.fr>
[posted and mailed]
Vladimir Afanasiev wrote:
>
> Where I can download freeware or shareware editor for PERL program
> (Win'95)?
What do you mean? Just just blocnote, edit, or any other ASCII editor
that you happen to like. Perl doesn't require any magical editors.
- doug
------------------------------
Date: 22 Oct 1997 10:57:06 GMT
From: coppari@cirfid.unibo.it (Maurizio Coppari)
Subject: Perl Novice need info
Message-Id: <62km62$1l4@sirio.cineca.it>
Hi all.
I'm getting to be involved in a new project, in wich I need to develop portable
CGI scripts in perl 5.
Is there a list of FAQ? Can anyone suggest a good tutiorial book? What
interpretars/compilers do you suggest to use under Unix and NT?
Thanks to all
Maurizio
------------------------------
Date: Wed, 22 Oct 1997 10:59:25 GMT
From: gmpieri@carroll.com (George Pieri)
Subject: Perl Pad function
Message-Id: <EIG9CD.FA7@nonexistent.com>
I wanted to left pad or right pad a string , so that the string would
be x characters wide. As far as I can see perl doesn't seem to have a
built in pad function
e.g.
lpad($str,"0",15) ; # left pad the string with 0s
It looks like I can use the pack function to do padding as described
above but I wanted to make sure that no other better function exists.
Thanks in advance!
------------------------------
Date: 22 Oct 97 03:09:59 GMT
From: nagy@darwin.topend.com.au (Robert Nagy)
Subject: Question: Using Modules
Message-Id: <344d6e87.0@news.topend.com.au>
Hi Folks,
I've been do a little work with perl lately and I am enjoying the change
from shell programming and awk programming.
The question I have relates to modules. I've look around and haven't
been able to find the relevant info or any sample programs.
There is a module I want to use called Edit.pm
The problem I am having is I can't seem to call any of the functions from
it.
Even getting it into the perl program seems to cause problems.
Setting it as
use Edit ();
reports no loading errors. however trying
use Edit;
does give me errors.
Can someone give me a clue as to what I am doing wrong.
Other modules like Carp work just fine.
Even a snippet of sample source code would be appreciated.
Robert Nagy
------------------------------
Date: Wed, 22 Oct 1997 11:33:59 +0200
From: Doug Seay <seay@absyss.fr>
To: Allen Choy <achoy@us.oracle.com>
Subject: Re: Un-require lib files
Message-Id: <344DC887.2B4BD20F@absyss.fr>
[posted and mailed]
Allen Choy wrote:
>
> Anyone know of a way to undo a previous require statement?
What do you want to undo? The fact that it has been flaged as already
loaded? Do you want to undefine the subroutines it declared? How about
values it changed?
Try telling us what you want to do and maybe we'll come up with a way to
do it.
- doug
------------------------------
Date: Wed, 22 Oct 1997 10:30:33 GMT
From: G.C.Th.Wierda@AWT.nl (Gerben Wierda)
Subject: Why doesn't this work?
Message-Id: <EIG7ux.IuM@AWT.NL>
When I run
===========================================
#! /usr/local/bin/perl
my $path = 'fred';
use constant DBDIR1 => $path;
use constant DBDIR2 => "barney";
use constant USERNAME => scalar getpwuid($<);
warn "Expected output, fred, barney and your username all on one line\n";
warn "@{[ DBDIR1 ]}, @{[ DBDIR2 ]}, @{[ USERNAME ]}\n";
===========================================
I get
===========================================
Expected output, fred, barney and your username all on one line
, barney, gerben
===========================================
Running perl 5.004_03 under NEXTSTEP 3.3.
---
Gerben Wierda,
Stafmedewerker Adviesraad voor het Wetenschaps- en Technologiebeleid.
Staff member Advisory Council for Science and Technology Policy
Javastraat 42, 2585 AP, Den Haag/The Hague, The Netherlands
Tel (+31) 70 3639922 Fax (+31) 70 3608992
http://www.AWT.nl/prive/wierda/
The fox knows many things, but the hedgehog knows one big thing.
"You know your country is dying when you have to make a distinction between
what is moral and ethical, and what is legal."
- John De Armond <jgd@dixie.com>, _Performance_Engineering_Magazine_, 1994
------------------------------
Date: 22 Oct 1997 08:40:52 GMT
From: k-sato@res.otaru-uc.ac.jp (Kou Sato)
Subject: WWW::Search and AltaVista
Message-Id: <62ke6k$erh$1@gemini.res.otaru-uc.ac.jp>
Hello. I have a question about WWW::Search and AltaVista.
With a program like the following one, I could get almost
all of the links found by AltaVista until at least last Apr.
use strict;
use WWW::Search;
my($search) = new WWW::Search('AltaVista');
my($query) = $queries{"query"};
$query_opt_ref->{"pg"} = WWW::Search::escape_query("aq");
$query_opt_ref->{"what"} = WWW::Search::escape_query("web");
my($native_qstr) = WWW::Search::escape_query($query);
$search->native_query($native_qstr, $query_opt_ref);
my($next_res);
while ($next_res = $search->next_result()) {
&print_result($next_res);
}
But after AltaVist changed its interface(?) and I updated
WWW::Search, I only get the first 10 links. Can anybody
tell me why this happend and how to solve the problem?
Thank you.
-
Koh Sato,
k-sato@res.otaru-uc.ac.jp
------------------------------
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 1212
**************************************