[12857] in Perl-Users-Digest
Perl-Users Digest, Issue: 267 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 27 01:07:17 1999
Date: Mon, 26 Jul 1999 22:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 26 Jul 1999 Volume: 9 Number: 267
Today's topics:
Another host_addr question (Vicki Surratt)
Re: Beginner-friendly group as cultural adaptation? (Martien Verbruggen)
Re: Beginner-friendly group as cultural adaptation? (Ronald J Kimball)
Re: CGI - Perl Question (Ronald J Kimball)
Custom HTML functions - I could use some direction, hin (Chris)
Description of code../ <scmpoper@scmp.com>
ebcdic packed numbers <frech@primary.net>
Re: Geekspeak Programming Contest <kejoki@netdoor.com>
Re: Geekspeak Programming Contest <tchrist@mox.perl.com>
Re: group variables in script (Tad McClellan)
Re: How can I get the number of users who are logging? <kmonte@columbus.rr.com>
InoculateIT detected the (Win95.Spanska_Happy99) virus InoculateIT
Re: Korn Shell or Perl? <uri@sysarch.com>
Re: Korn Shell or Perl? <tchrist@mox.perl.com>
Re: Need installation help on Apache or PWS <ron_savage@non-hp-australia-om5.om.hp.com>
Re: Outputting text as entered by user (Martien Verbruggen)
Re: Perl Socket Problem (Martien Verbruggen)
Re: Perl, FTP, and Win32 with IIS (ouch) <ehpoole@ingress.com>
Re: RegEx: Capitalize 1st char. of string with spaces <ron_savage@non-hp-australia-om5.om.hp.com>
Re: remove records from database (Martien Verbruggen)
Re: Removing characters <JFedor@datacom-css.com>
Re: Replacing and Stripping HTML (Tad McClellan)
Re: Server 500 error? (Tad McClellan)
Re: Special problem (Networking) (Martien Verbruggen)
Re: Which group is appropriate? <kejoki@netdoor.com>
Re: Won't read from STDIN inside html tags (Tad McClellan)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 26 Jul 1999 22:39:11 -0600
From: vicki@vickishome.com (Vicki Surratt)
Subject: Another host_addr question
Message-Id: <1dvkmgb.2wnoay1k28edoN@ip200.houston5.tx.pub-ip.psi.net>
I've read all the messages I could find about this subject, but I'm
still stumped.
I am trying to display the host_addr variable on the screen. It appears
my webhost has dns lookup turned off on the server. I have tried a
simple ssi echoing host_addr, and I've tried an ssi exec in which a perl
script is executed to get $ENV{'REMOTE_HOST'}. In both cases, all I get
is the IP address. I tried updating my .htaccess file (which I can
usually update), but it errors out when I tried to turn dns lookup on.
I'm wanting the host_addr to display automatically when the visitor goes
to that particular page rather than expecting them to type in their IP
address.
So what's next? Is there another way to have the information displayed?
Is there any way to use the IP address to automatically lookup the host
address in a perl script?
Take Care!
Vicki Surratt
vicki@vickishome.com
Visit my website! http://www.vickishome.com
------------------------------
Date: Tue, 27 Jul 1999 03:18:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <Kx9n3.401$1m.40786@nsw.nnrp.telstra.net>
In article <379cae41$0$214@nntp1.ba.best.com>,
John Callender <jbc@shell2.la.best.com> writes:
> There has been some very interesting (to me at least) discussion here
> lately justifying this group's norms as a cultural legacy to which
> newcomers should be expected to adapt, just as strangers in a new
> country should learn the local customs.
I've posted something about this last time it came up on this
group, and I'll more or less repeat my views on it:
Nobody has troubles with newbies per se. As long as they show they've
done their best to find answers themselves, I don't mind quoting part
of the documentation to them, and telling them how to find it for next
time. Most people react the same way. As long as the quesiton is
clearly stated, on topic, and there's a basic display of having done
some work to find the answer, no one here minds holding their hands
for a while.
The people that cause all the flames, and endless repetition of Usenet
posting rules are the ones that show that they have no clue, are lazy,
often arrogant, and too narrow in thinking to realise that there are
other groups for the issues they raise, and that we don't want to talk
about the whole world of programming and all its applications. We want
to talk about Perl. We want them to read the documentation that has
been provided for most of their questions.
Creating a new group for newbies will not help anyone. The bad apples
will still post here, and just crosspost to all other groups with
'perl' in the name. Auto-cancels of these crossposts won't make it
much better, because they'll just start posting copies, if they didn't
do so at the start. The newbies who _are_ eager to learn, and have the
potential will sit in a group that can't teach them anything, because
there is no one there that has decent answers.
I fear that there is no simple answer to this problem, and I also fear
that there may not be an answer at all. Creating a separate group for
newbies, IMO, is definitely not the answer. No one benefits in that
way, and some people will actually be worse off.
Maybe the auto-pollution that TC has set up here will prevent, or is
already preventing, some of the noise. I personally think it's a good
idea. It's easily filtered out, and makes it clear to a new person
that there is actually documentation out there.
Don't forget that we only see the ones that don't read before they
post. We only see the ones that are clueless and rude. The other ones
don't post, and possibly have already found their answers in the
documentation, or thanks to the periodical FAQ post. There simply is
no way for us to reliably know how effective these posts are.
We'll just have to keep telling the bad ones how bad they are. Even if
it creates noise, because ignoring them won't work, and it won't teach
them anything.
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Tue, 27 Jul 1999 00:32:41 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <1dvkpa5.u8qwc3q6vfliN@p29.block2.tc4.state.ma.tiac.com>
John Callender <jbc@shell2.la.best.com> wrote:
> This may well be doomed from the outset. If you really hate the idea
> and would vote against it under any circumstances, please consider
> letting me know either publicly or privately.
If I vote for it, and the group is created, then fails to live up to its
mission, will people stop bringing up the idea of creating such a
nesgroup?
Probably not.
But when people do bring it up, at least we can tell them it has been
tried, and it didn't work, and hopefully that will shut them up.
So I might vote for it.
But if you really want discussion, why not post a formal RFD?
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 27 Jul 1999 00:32:43 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: CGI - Perl Question
Message-Id: <1dvkphk.myfxbkjdw679N@p29.block2.tc4.state.ma.tiac.com>
<frank_hampshire@bigfoot.com> wrote:
> The text that appears after the sumbit button has been clicked appears
> at the bottom of form (I guess thats expected), however I would like to
> get it to appear on a new page.
>
> I have been unable to find an answer for this on any of the FAQs. Is
> there something really obvious I am missing?
You're missing something. Specifically, logic that determines whether
the form is being requested or submitted, and acts appropriately.
If the script is being called with no parameters, you should print the
form. Otherwise, you should parse the form and print the results.
For example:
my $form = new CGI;
print $form->header;
print $form->start_html;
if ($form->param("submit"))
{
print "<P>You entered".$form->param(TEST)."</P>";
}
else
{
print $form->startform;
print "<h1>The Form</h1>";
print $form->textfield("TEST");
print $form->submit;
print $form->endform;
}
print $form->end_html;
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 27 Jul 1999 05:04:47 GMT
From: cnlsilva@gte.net (Chris)
Subject: Custom HTML functions - I could use some direction, hints, help! :-)
Message-Id: <37a43e0a.9740708@news.gte.net>
1st I have created a script like this and 2nd so have a million other
people. I also had a hell of a time trying to find this very simple
little snippet of Regex code:
you can probably use:
$string =~ s/<poll>(.*?)<//poll>/$replacement_string/sg;
I use this to replace between comments like
<!--begin main body text--> and
<!--end main body text-->
enjoy ;)
I am attempting to modify a script to allow a HTML page to be updated
dynamically. I want to use a custom tag <poll> and </poll> to allow
ew information to be updated to the page in a easy to use manner.
I have Mastering Regular Expressions and Programming Perl and was not
able to find a model in which a string\output was put inbetwent two
tags located anywhere in a file - any help or direction???
Thanks in advance...
------------------------------
Date: Tue, 27 Jul 1999 10:36:51 +0800
From: scmpoper <scmpoper@scmp.com>
Subject: Description of code../
Message-Id: <379D1B42.F1FB31F8@scmp.com>
Hello all:
I am learning perl myself, and i found some difficulty on
command "study".there are example code below which from
"Programming Perl" page 226, but i don't understand what
it does from line 3 to line 10. description line by line
is appreciate and many thank...
1 $seach= 'while (< >) {study;';
2 foreach $word (@words) {
3 $search .= "++\$seen{\$ARGV} if /\\b$word\\b/;\n";
4 }
5 $search .="}";
6 @ARGV = @files;
7 undef $/; # slurp aech antire file
8 eval $search; # this screams
9 die $@ id $@; # in case eval failed
10 $/ = "\n"; # put back to normal input delim
11 foreach $file (sort keys(%seen)) {
12 print $file,"\n";
}
------------------------------
Date: Mon, 26 Jul 1999 23:08:01 -0500
From: "Norman Frech" <frech@primary.net>
Subject: ebcdic packed numbers
Message-Id: <cian3.28$Tw1.5756@news1.primary.net>
I have a ebcdic to ascii converter that works well on everything but packed
numbers (signed and unsigned). Does anyone have a tip or code that converts
this field type?
Norm <frech@primary.net>
------------------------------
Date: Mon, 26 Jul 1999 21:12:22 -0500
From: Kevin Kinnell <kejoki@netdoor.com>
Subject: Re: Geekspeak Programming Contest
Message-Id: <379D1586.C5EEA220@netdoor.com>
Tom Christiansen wrote:
> ... I suggest writing "noon" and "midnight", not "12:00am" or
> "12:00pm", as the former are unabiguous and the latter are not.
> I know -- it's a problem in a numeric-only input field, but
> works just fine for speech or free-form correspondence....
I tend to agree, but just watch someone's face while they're parsing
"noon-thirty" for the first time.
--
Kevin Kinnell <kejoki@netdoor.com>
------------------------------
Date: 26 Jul 1999 22:40:19 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Geekspeak Programming Contest
Message-Id: <379d3833@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Kevin Kinnell <kejoki@netdoor.com> writes:
:I tend to agree, but just watch someone's face while they're parsing
:"noon-thirty" for the first time.
Really? My friends and I say it all the time. I'm not kidding at all.
--tom
--
"Sometimes I wish I could put an expiration date on my quotes." --Larry Wall
------------------------------
Date: Mon, 26 Jul 1999 16:41:53 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: group variables in script
Message-Id: <h6hin7.2jj.ln@magna.metronet.com>
dbrodigan@my-deja.com wrote:
: It
: seems to be running ok, however, when I modified
: it by expanding the groups, it displays the
: variable as if it was html whereas it should be
: interpreted like the other variables. I'm unable
: to located where this variable discrepancy is,
It is right near where you modified it then.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 27 Jul 1999 00:39:54 -0400
From: "Kenn Monte" <kmonte@columbus.rr.com>
Subject: Re: How can I get the number of users who are logging?
Message-Id: <lLan3.1300$jB5.103709@viper>
chomp($Users = `who|wc -l`);
Sanon Chowchaiyaporn <csanon@hotmail.com> wrote in message
news:379be02c.0@news.tamu-commerce.edu...
> Hi! everybody,
>
> I tried to write a program that shows the number of people who are logging
> in. Can I just simply use $num=system 'w|wc -l'? If it's not, how can I do
> it?
>
> Thanks
> Kidd
>
>
>
------------------------------
Date: Tue, 27 Jul 1999 06:46:36 +0200
From: InoculateIT
Subject: InoculateIT detected the (Win95.Spanska_Happy99) virus in Mailbox (Public Folders), Sender (cnlsilva@gte.net (Chris)) !!!
Message-Id: <38DB2D6FC9C4D211904D00105AD009E849F9B4@exchange.do.prodv.de>
The (Win95.Spanska_Happy99) virus was detected in (Public
Folders\Happy99.exe) and was sent by (cnlsilva@gte.net (Chris)). Action:
(No Action.).
------------------------------
Date: 26 Jul 1999 22:08:44 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Korn Shell or Perl?
Message-Id: <x7wvvmu9n7.fsf@home.sysarch.com>
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
why did you repost this dreck?
wang keeps trying to do wierd things with do blocks in for loops. he has
recently posted several crazy pieces of perl code with do blocks to both
misc and moderated and has me wondering if he is for real. by trying to
do all the work inside the for () he is making the code totally opaque
and impenetrable.
TC> I would like to use the following code to illustrate Perl awkwardness
TC> and inefficiency. It is quite easy and straightforward with shell's
TC> pipelines, which Perl does not have. What Perl has is limited Korn
TC> shell equivalent $(...).
this is more a demonstration of the inefficiency of your programming
skills. this can't be done easily in shell but it is trivial in perl if
you think correctly. as this is not spec'ed fully my code may not work
but it will give you an idea of how to do it. and STOP with the do{}
blocks. very rarely are they needed and you seem to think they are the
only way to do things in perl.
TC> foreach $j ( do {
TC> if ( $opt_d eq "all" ) {
TC> do { foreach ( split(/,/, $opt_b) ) {
TC> if ( /local/ ) {
TC> keys(%::beeper_byname);
TC> } elsif ( /yp/ ) {
TC> open(FH, "ypcat -k beeper.byname |")
TC> or die("cannot fork: $!\n");
TC> map ( {
TC> /(\w+)\s+\w+/ && $1
TC> } <FH> );
TC> }
TC> }}
TC> } else {
TC> split(/,\s*/, $opt_d);
TC> }
TC> }
TC> ) {
TC> unless ( $j eq "YP_LAST_MODIFIED" || $j eq "YP_MASTER_NAME" ) {
TC> ($k, @devnull)=get_pin("0", "1", "0", $opt_b, $j);
TC> $exit_status+=$k;
TC> }
if ( $opt_d ne 'all' ) {
@yp_data = split(/,\s*/, $opt_d);
}
else {
foreach $source ( split( /,/, $opt_b) ) {
push( @yp_data, keys %::beeper_byname ) && next
if $source eq 'local'
if ( $source eq 'yp' ) {
@beepers = `ypcat -k beeper.byname` ;
push( @yp_data, map( /(\w+)/, @beepers ) ) ;
}
}
}
foreach $yp ( @yp_data ) {
next if $yp =~ /^YP_/ ;
($k, @devnull)=get_pin("0", "1", "0", $opt_b, $j);
$exit_status+=$k;
}
now isn't that simpler and clearer than the crap you wrote below. and NO
do blocks are needed. STOP THAT HABIT NOW!!!!
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 26 Jul 1999 22:39:49 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Korn Shell or Perl?
Message-Id: <379d3815@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Uri Guttman <uri@sysarch.com> writes:
:why did you repost this dreck?
Because the cretin was defecating where he thought we weren't looking.
--tom
--
The X server has to be the biggest program I've ever seen that doesn't
do anything for you. --Ken Thompson
------------------------------
Date: Tue, 27 Jul 1999 13:54:14 +1000
From: "Ron Savage" <ron_savage@non-hp-australia-om5.om.hp.com>
Subject: Re: Need installation help on Apache or PWS
Message-Id: <7njas4$911$1@ocean.cup.hp.com>
As a last resort you could try configureApache.pl from my web site.
--
Cheers
Bus: rons@hpaco.aus.hp.com
Home: ron@savage.net.au
http://savage.net.au/
Marko Cehaja wrote in message <7ngilc$men$1@news.online.de>...
>Hi
>
>I want to debug and run my cgi and pl scripts on Windows 98. I have Apache
>server and if needed the Microsoft Personal Webserver. My perl is installed
>properly and it runs scripts, but under PWS and Apache, doesnt write new
>files, or it can open files.
>
>I don't see how to change that on Apache or on PWS. So, the problem is that
>I want my CGI scripts to be able to WRITE something on the harddisk. And I
>use it just for debugging as a local server.
>
>Can someone can help about that basic installation?
>
>I spent already a whole day trying to install that all properly but it
>didn't work.
>
>
>Thanks,
>Marko
>
>
------------------------------
Date: Tue, 27 Jul 1999 02:47:49 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Outputting text as entered by user
Message-Id: <p59n3.397$1m.40786@nsw.nnrp.telstra.net>
In article <7nhi5k$8r$1@bertrand.ccs.carleton.ca>,
ansingam@chat.carleton.ca (Arul Singam) writes:
>> > Please email or post to newsgroup.
>
>> I think that either one of the two would have been the default action
>> for almost any newsreader. There really was no need to post that.
>
> Dont you see the "or"? That means it is unneccessary to do "both".
> Get some grammar knowledge in your brain before blabbering.
Huh? Since when does it mean that? 'or' has been ambiguous for a long
time.
Grammatical 'or' is not the same as mathematical 'or'.
The point I made still stands.
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd. | negative.
NSW, Australia |
------------------------------
Date: Tue, 27 Jul 1999 02:34:57 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl Socket Problem
Message-Id: <lV8n3.372$1m.40786@nsw.nnrp.telstra.net>
[Removed non-group alt.perl]
In article <7nhhtg$ove$1@nntp0.reith.bbc.co.uk>,
"James Williamson" <james.williamson@bbc.co.uk> writes:
> I'll tell you why, using virtual servers offers you the option to host
> numerous sites with a single IP address, as my domain name IP address is
> also the IP address of the company who hosts my website. This might be your
> problem?
This is not _generally_ true. It only works for certain browsers. To
find out why, ask in a group that talks about HTTP.
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Tue, 27 Jul 1999 00:30:16 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: Perl, FTP, and Win32 with IIS (ouch)
Message-Id: <379D35D8.B3A89A76@ingress.com>
herifhanna@my-deja.com wrote:
>
> I want to write a cgi perl script, which interfaces with IIS, that will
> ftp to a remote computer, download a text file into a local directory,
> and then generate an html file with a link to the downloaded file. How
> do I do it?
>
> I'm using IIS 4 on NTSP4. I'm guessing I need the Net:FTP module, but I
> can't find a Win32 version (all distributions that I found require
> make...that won't fly in NT; or will it?)
Or you could script an FTP session using "ftp.exe -s:scriptfilename" as
per "ftp.exe -help". After the FTP completes, then run a perl script to
generate an appropriate HTML file. The rest of the solution is for you to
learn, but fairly trivial.
--
Ethan H. Poole **** BUSINESS ****
ehpoole@ingress.com ==Interact2Day, Inc.==
(personal) http://www.interact2day.com/
------------------------------
Date: Tue, 27 Jul 1999 13:52:48 +1000
From: "Ron Savage" <ron_savage@non-hp-australia-om5.om.hp.com>
Subject: Re: RegEx: Capitalize 1st char. of string with spaces
Message-Id: <7njapd$90r$1@ocean.cup.hp.com>
Tested:
#!perl -w
use integer;
use strict;
# ----------------------------------
sub fix
{
my($s) = @_;
print "Before: $s. After: ";
$s =~ s/^(.?)(.*)/\u$1$2/;
print "$s. \n";
}
# ----------------------------------
&fix('');
&fix('Hi');
&fix('hi');
&fix('Hello world');
&fix('hello world');
--
Cheers
Bus: rons@hpaco.aus.hp.com
Home: ron@savage.net.au
http://savage.net.au/
John J. Coupal wrote in message <932965762.673.84@news.remarQ.com>...
>What I would like to do is be able to capitalize the 1st character of any
>string that may or may not have spaces.
>
>For example:
>
>"come back here" translates to "Come back here"
>and
>"cherry" translates to "Cherry"
>
>I tried:
>
>$var =~ s/^./\u/g;
>
>and
>
>$a =~ tr/^[\w]/\u/;
>
>Any help would be appreciated!
>
>
------------------------------
Date: Tue, 27 Jul 1999 02:43:44 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: remove records from database
Message-Id: <A19n3.394$1m.40786@nsw.nnrp.telstra.net>
In article <7nhsi3$gfj$1@nnrp1.deja.com>,
inlandpac@my-deja.com writes:
> I am talking about a flat file (| delimited).
Ok, so we finally got that part sorted out. Why didn't you say so in
your original post? it really is in _your_ best interest to be as
specific and clear about what you need and use to get good answers.
[snip of long whinge]
Listen. I asked you specific questions about what exactly it is you
are trying to achieve. I asked you specific questions about defining
what you mean by certain terms. Instead of answering those, and giving
people a chance to understand what you are talking about, you whinge
about us not having enough patience or insight in your psyche to be
able to answer you, and write all the code for you.
If you want help, you'll have to tell us what you want help with. No
one here will write your code for you, unless you are willing to hire
them. Well-phrased, clear questions that are questions about perl
always get answered here. Even well-phrased questions about algorithms
get their answers.
Badly phrased, unclear, unspecific answers that show no input of your
own get ignored or flamed. And sometimes people try to get you to make
yourself more clear. Instead of whining, you should take the chance,
and make yourself more clear.
Now you've wasted a chance for help.
Martien
--
Martien Verbruggen |
Interactive Media Division | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: Mon, 26 Jul 1999 23:10:15 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: Removing characters
Message-Id: <7nj5vv$jqn$1@plonk.apk.net>
Tad McClellan wrote in message <8d4hn7.ueh.ln@magna.metronet.com>...
>Jody Fedor (JFedor@datacom-css.com) wrote:
>
>: Jimtaylor5 wrote in message
>: <19990725161814.21146.00001525@ng-fx1.aol.com>...
>: >I'm trying to remove every first character of my variables. If it was on
>: the
>: >end I could use chop, but how would I remove one character at the front
>: without
>: >leaving a space?
>
>: $var = "12345";
>: $var =~ s/.//;
>: print $var;
>
>
> Try it with:
>
> $var = "\n12345";
>
>
>: Works too!
>
>
> Works _sometimes_.
The operative word here is remove every first character (not control
character). You have to make a few assumptions in these requests, such as
they are probably reading in a file delimited or end of record by \n or \n
\r. (At least all my file EOF are \n but I made the file in the first
place!) I guess I shouldn't read so much into the questions.
Jody
------------------------------
Date: Mon, 26 Jul 1999 16:31:41 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Replacing and Stripping HTML
Message-Id: <djgin7.2jj.ln@magna.metronet.com>
Keith G. Murphy (keithmur@mindspring.com) wrote:
: Abigail wrote:
: > about it. It doesn't know about marked sections, nettags, and not even CDATA
: > marked sections.
: Marked sections? Nettags? CDATA marked sections?
Those are all features of SGML, which became an ISO standard in 1986.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 26 Jul 1999 16:49:15 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Server 500 error?
Message-Id: <bkhin7.2jj.ln@magna.metronet.com>
Stuart (Stuart@worm.globalnet.co.uk) wrote:
: I am new to cgi programming
It appears that you are also new to Usenet, as you have
made a social blunder.
You might want to check out some of the articles in
news.announce.newusers
to find out how to get them most from Usenet.
You are expected to check the FAQ (Frequently Asked Questions)
list relevant to a newsgroup *before* you post to the newsgroup.
: I get a HTTP 500 server error, would anyone be kind enough to explain what
^^^
^^^
: this means as I can't find it in any documentation.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sorry, but I don't think you looked very hard.
perldoc -q 500
=head1 Found in /usr/lib/perl5/pod/perlfaq9.pod
=head2 My CGI script runs from the command line but not the browser.
(500 Server Error)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 27 Jul 1999 04:47:46 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Special problem (Networking)
Message-Id: <SRan3.427$1m.43482@nsw.nnrp.telstra.net>
In article <9egr9lv3gnd.fsf@coop.rz.uni-frankfurt.de>,
specker@coop.rz.uni-frankfurt.de writes:
> I am working on AIX 4.x with Perl5.005_02 and want
> to monitor established connections on a maschine via perl.
> Up to now we do it using a ksh script which calls
>
> netstat -nf inet
>
> and grep to get the tcp-connections with the state ESTABLISHED.
Sounds like a good solution to me.
> This solution is rather sluggish with many connections,
> so i want to try using perl.
I doubt very much that perl can do it much faster. netstat -n is
probably the fastest method around. If the sluggishness you experience
is a shell problem, and not a netstat problem (does it run as fast
from the command line as you expect?), you can do this in perl in
several ways, of which the following are probably reasonable ones:
use strict;
my $netstat = '/usr/bin/netstat -nf inet';
my @EstConns;
@EstConns = map { chomp; $_ } grep { /ESTABLISHED$/ } qx( $netstat );
die "$netstat returned $?" if ($?);
open(NETSTAT, "$netstat |") || die "Cannot fork: $!";
@EstConns = map { chomp; $_ } grep { /ESTABLISHED$/ } <NETSTAT>;
close(NETSTAT) || die "Bad return from $netstat: $! $?";
Instead of reading all of it into an array at once, you can of course
set up a while loop for the second one. On very busy servers we
normally don't see much more than a few thousand established
connections, and I wouldn't worry too much about the memory
requirements for that.
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd. | excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Mon, 26 Jul 1999 21:48:55 -0500
From: Kevin Kinnell <kejoki@netdoor.com>
Subject: Re: Which group is appropriate?
Message-Id: <379D1E17.50361935@netdoor.com>
Jonathan Stowe wrote:
...
> Er, comp.lang.perl doesnt exist - hasnt done for a while ...
That's what the faq says, but it exists on my ISP's news server,
and on the local U's news server, and it gets quite a few
posts from many other domains than those I just mentioned--probably
from people who haven't read the faq and don't realize it's just
a figment. ;-)
...
> No you've just got to read the documentation and then take the
> ridicule just like everyone else ... You'll be better for it in the
> end.
Maybe. Biting sarcasm, direct attack, and telling people they're
stupid if they haven't found the answer for themselves *do* seem
to be the norm in hacker culture. (I hope few hackers have kids.)
But...
Thanks to Microcruft et al, a *huge* influx of immigrants has been
pouring into Usenet. What's perfectly acceptable in the existing
culture may not continue to work, because immigrants always change
the culture they're ``invading''.
I dunno the answer, but I think a c.l.p.novice group might cut the
level of invalid posts to this group. Non hackers would be more
apt to stay in a group in which they felt less threatened.
--
Kevin Kinnell <kejoki@netdoor.com>
------------------------------
Date: Mon, 26 Jul 1999 17:59:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Won't read from STDIN inside html tags
Message-Id: <rnlin7.anj.ln@magna.metronet.com>
Andy Collado (acollado@uiuc.edu) wrote:
: This is some of the code I am using to redirect my users to their home
: directories.
: The supply their username and that directs them to their home pages..
: &parse;
: $yourpage=$FORM{yourpage};
: print "<frame src=\"/$yourpage/\" scrolling=auto noresize
[snip]
: But all it prints out is this:
: <frame src="//" scrolling=auto noresize border="1">
: Please advise.
Can't.
You haven't shown us what parse() does (not much, apparently :-).
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 267
*************************************