[18857] in Perl-Users-Digest
Perl-Users Digest, Issue: 1025 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 31 03:05:47 2001
Date: Thu, 31 May 2001 00:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <991292715-v10-i1025@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 31 May 2001 Volume: 10 Number: 1025
Today's topics:
Re: Complicated...heh <uri@sysarch.com>
Re: Complicated...heh <smichae@ilstu.edu>
Re: Complicated...heh (Eric Bohlman)
Re: Complicated...heh <godzilla@stomp.stomp.tokyo>
Re: Complicated...heh <godzilla@stomp.stomp.tokyo>
datacalc.pm (Dirk Lorenz)
Re: exec script w/require & headers <webmaster@webdragon.unmunge.net>
Re: Frustrated people (not) answering questions <comdog@panix.com>
Re: How Can abtain yesterday or nextday <buggs@geekmail.de>
Re: How Can abtain yesterday or nextday (Eric Bohlman)
Re: How Can abtain yesterday or nextday <buggs@geekmail.de>
Re: How can I migirate installed&configured activeperl5 <mn_eric@email.com>
Re: Modifying PM's <comdog@panix.com>
Opinion on undef lvalue <johnlin@chttl.com.tw>
Re: Perl Community Stars (?) <pne-news-20010531@newton.digitalspace.net>
Re: Perl Community Stars (?) <comdog@panix.com>
Re: Perl request <pne-news-20010531@newton.digitalspace.net>
Re: Rounding <webmaster@webdragon.unmunge.net>
Re: Rounding (Abigail)
Re: Stripping a string down to aplhaNumeric characters/ <pne-news-20010531@newton.digitalspace.net>
Substitution on .htm files (felan)
Re: Unsure about headers <comdog@panix.com>
Re: Unsure about headers <comdog@panix.com>
Re: what does this mean? <webmaster@webdragon.unmunge.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 31 May 2001 04:05:16 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Complicated...heh
Message-Id: <x7pucqyxhf.fsf@home.sysarch.com>
>>>>> "SM" == Steven Michaels <smichae@ilstu.edu> writes:
SM> Yes, I've tried that before, and it doesn't work for some reason.
what do you mean didn't work?
and i noticed that you referred to that above. what that is that? i see
no that. ohh, you top posted!! you are replying to my post which is
below and fully quoted. but you only referred to a single that. i gather
that is that one line of perl i posted. so if that is the only that that
you referred to, why did you quote my entire letter including all of the
stuff i quoted from you. that is a good question. and that is the
reason that top posting is severely deprecated on usenet. so that that
use of that will not be abiguous. if that were written about something
before that that is written, then that that will be logically associated
with the quoted part that is before the that in question.
that means that the conclusion is that bottom posting solves pronoun
troubles and that top posting exacerbates that problem.
>> $buf =~ s/-\n/-/g ;
my one liner that didn't work for that top poster. showing us input and
the incorrect output of applying that code would verify that
assertion. that is the best thing for you to do to show that code is
wrong. can you provide that?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Wed, 30 May 2001 23:21:49 -0500
From: "Steven Michaels" <smichae@ilstu.edu>
Subject: Re: Complicated...heh
Message-Id: <9f4gqu$39s$1@news.ilstu.edu>
> Then your data presented in your article, is not your true data.
> Without a precise and exact sample of your data no one person
> can provide an answer without guessing.
My exact data can be found by viewing the source of the following
page: http://weather.myip.org/source.txt
>
> Should I be presented with this problem, my first test
> would be to remove any possible carriage returns, then
> try the substitution presented by Uri.
>
> $buf =~ tr/\r//d;
> $buf =~ s/-\n/-/g;
>
> If this works,
>
> $buf =~ s/-\r\n/-/g;
>
> would be a logical code snippet to test.
>
> If this failed, I would work on replacing all characters
> with "print visible characters" to discover if there is
> something in there which cannot be printed. Usually a
> good program editor will find these if you know what
> codes to enter for a search and replace.
>
What I think the problem is, is that $buf is read once, as a huge
source, without splitting the lines. This may or may not be the
cause of none of the above snippets to work.
> What type of system is generating your data initially?
> Otherwords, where is your data originating? Some systems
> add characters which are print invisible.
It's with the latest perl vision on apache
------------------------------
Date: 31 May 2001 04:23:13 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Complicated...heh
Message-Id: <9f4gvh$rvi$3@bob.news.rcn.net>
Steven Michaels <smichae@ilstu.edu> wrote:
> Hello! I was wondering if anyone can help me on this
> pretty complex (for me) problem. I have a program that
> reads data from the national weather service (weather
> warnings) and translates them onto a map. There are
> county codes on the top of each transmission, and I
> use these to color the map. The problem is that the county
> codes must be on one line to be readable by the program.
> In some files, they are on two lines, separated by a new
> line \n. The program below currently does the job, but is
> EXTREMELY slow, especially considering that it goes
> through thousands of files and has to look at each individual
> line. I was wondering if there was a way to simply look at
> the end of each line in the file, and if it ended with a -, then
> have it remove the \n from that line, making the next line jump
> up to the first. I will post the current SLOW programming,
> along with a sample of what I need, and what it gives me:
> @essay = split(/\n/,$buf);
Don't do this yet.
Since everything is still one big string, with newlines being just
characters, you can stop thinking in terms of joining lines and start
thinking in terms of deleting newline characters that are preceded by
dashes:
$buf =~ s/-\n/-/g;
After doing this, you can split the string into indivdual lines if you
need to process it that way. This should be much faster because all the
work is being done in perl instead of Perl :)
------------------------------
Date: Wed, 30 May 2001 21:43:16 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Complicated...heh
Message-Id: <3B15CBE4.8BE39389@stomp.stomp.tokyo>
Steven Michaels wrote:
> > Then your data presented in your article, is not your true data.
> > Without a precise and exact sample of your data no one person
> > can provide an answer without guessing.
> My exact data can be found by viewing the source of the following
> page: http://weather.myip.org/source.txt
If there are print invisible characters in your data,
they won't show in a plaintext document, just like
they won't show here, both are plaintext.
> > Should I be presented with this problem, my first test
> > would be to remove any possible carriage returns, then
> > try the substitution presented by Uri.
> > $buf =~ tr/\r//d;
> > $buf =~ s/-\n/-/g;
> > If this works,
> > $buf =~ s/-\r\n/-/g;
> > would be a logical code snippet to test.
> > If this failed, I would work on replacing all characters
> > with "print visible characters" to discover if there is
> > something in there which cannot be printed. Usually a
> > good program editor will find these if you know what
> > codes to enter for a search and replace.
> What I think the problem is, is that $buf is read once, as a huge
> source, without splitting the lines. This may or may not be the
> cause of none of the above snippets to work.
This should not be related. There is something in your data
causing a regex match to fail, something other than just
a simple newline character.
Another test would be to play around with your array, @essay,
see what is actually in your elements and, take into consideration
the source of this array.
> > What type of system is generating your data initially?
> > Otherwords, where is your data originating? Some systems
> > add characters which are print invisible.
> It's with the latest perl vision on apache
No, no! What I am asking is from where does your data come?
Clearly this data is not generated on your local machine.
Doesn't look like NOAA data to me, but it is originating
from somewhere outside your local system. This orginating
source could very well be adding characters unknown to you.
I would urge you to test removal of carriage returns \r before
testing anything else. I have a hunch this is the problem.
Are you familiar with \012 \015 type formats? Like what
you find in headers. Might be something similar to this
which perl core cannot regex match.
Incidently, you are _not_ viewing your data with a viewer
which word wraps, right? If so, set your word wrap point
to a setting higher than the longest length of your data.
Godzilla!
------------------------------
Date: Wed, 30 May 2001 22:03:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Complicated...heh
Message-Id: <3B15D0B9.620161D6@stomp.stomp.tokyo>
"Godzilla!" wrote:
> Steven Michaels wrote:
(snippage)
> > My exact data can be found by viewing the source of the following
> > page: http://weather.myip.org/source.txt
See this?
<-- should be a tiny square
This is data in your source.txt which is "partially"
invisible to a print. This usually happens when you
have binary data mixed in with "normal" text data.
It could also be any one of numerous oddball characters
which don't print right. This is a good indication you
have other data in there which may be print invisible.
Try cleaning your data by removing all characters
except those which you need. I haven't looked close
and have no way of knowing just what all is needed
by you.
$buf =~ s/[^a-zA-z0-9\- ]//g;
Add whatever other characters you need to my
character set. This should clear all those
oddball characters sneaking into your data.
Godzilla!
------------------------------
Date: 30 May 2001 23:22:48 -0700
From: dirk.lorenz@de.ac-service.com (Dirk Lorenz)
Subject: datacalc.pm
Message-Id: <60145f9c.0105302222.eb9af8e@posting.google.com>
Hellp NG,
where can i get a compiled Version of the module datcalc.pm for Active
Perl bcause i have no C Compiler.
Thanks for your help.
Dirk Lorenz
------------------------------
Date: 31 May 2001 04:54:44 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: exec script w/require & headers
Message-Id: <9f4iqk$keg$2@216.155.32.179>
In article <29874-3B13D9CF-217@storefull-242.iap.bryant.webtv.net>,
dennis100@webtv.net (BUCK NAKED1) wrote:
|
| Re: exec script w/require & headers
|
| > see-sig@from.invalid (David Efflandt)
| >> dennis100@webtv.net wrote:
| >> How do I get rid of the headers. When >> I use
| >> require "pcount.pl";
| >> within another script, it executes
| >> "pcount.pl" as desired, but prints the >> content headers. FWIW, I
| have
| >> require "pcount.pl" right before my
| >> END block.
|
| > Think a little. Modify pcount.pl to NOT
| > print headers, or only when needed.
|
| Excuse me, but I "think", "do think", and "have thought". I thought of
| that solution already. I am also using pcount.pl for other files and
| therefore do not wish to change that file. I got it to work though just
| by using embed src. Of course, I could've used SSI or another solution
| too; but prefered a perl solution... thus the question posted here.
|
| > There is another newsgroup for CGI questions.
|
| David Effandt... who said anything about CGI? You assume too much.
|
| Regards,
| --Dennis
|
YOU yourself did. =:P
In article <29874-3B13E06C-220@storefull-242.iap.bryant.webtv.net>,
dennis100@webtv.net (BUCK NAKED1) wrote:
| FWIW... the file "pcount.pl" doesn't call out any headers or
| content-type. I guess the file that I call "pcount.pl" from ("bna.pl")
| is throwing them in. Probably because I use cgi.pm in "bna.pl".
| ^^^^^^
| --Dennis
|
Q.E.D.
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Thu, 31 May 2001 02:42:03 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Frustrated people (not) answering questions
Message-Id: <comdog-655ADF.02420331052001@news.panix.com>
In article <3b158516.9384143@news.usenet.com>, michael@visionpro.com
(Michael D. Risser) wrote:
> If you feel that the question is stupid, ignore it. I for one would
> rather have my question go unanswered than have someone attempt to
> degrade me for asking.
those aren't the only options or consequences though. there are
network effects.
unanswered posts often become answered when a less-than-proficient
poster guesses at an answer. this answer is archived on various
usenet search engines for everyone to see later. bad answers live
forever and cause more confusion and the cycle continues. indeed,
look at the fecundity of Matt W.'s crap programming.
or, you can just get used to taking your lumps. just about everyone
gets their lumps at one point or another, and i certainly take my
share when i have genuinely stupid ideas at work. the only
difference is how you personally decide to handle it.
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Thu, 31 May 2001 06:16:30 +0200
From: buggs <buggs@geekmail.de>
Subject: Re: How Can abtain yesterday or nextday
Message-Id: <9f4gfh$qi3$05$1@news.t-online.com>
Eric Bohlman wrote:
> And getting yesterday's date is just as easy:
>
> sub yesterday's_date {
> sleep -86400;
> my $temp=localtime; #now it's yesterday
> sleep 86401; #return to tommorrow possibly losing a second
> $temp;
> }
return to today that is ;-)
otherwise today wouldn't exist
Buggs
------------------------------
Date: 31 May 2001 04:37:56 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: How Can abtain yesterday or nextday
Message-Id: <9f4hr4$rvi$4@bob.news.rcn.net>
buggs <buggs@geekmail.de> wrote:
> Eric Bohlman wrote:
>> And getting yesterday's date is just as easy:
>>
>> sub yesterday's_date {
>> sleep -86400;
>> my $temp=localtime; #now it's yesterday
>> sleep 86401; #return to tommorrow possibly losing a second
>> $temp;
>> }
> return to today that is ;-)
> otherwise today wouldn't exist
But after the negative sleep, "today" is in fact tomorrow from the
program's perspective.
In case I didn't make it clear, the reason for the extra second on the
second sleep is that if the clock rolled over during the call to
localtime, the jump into the future might be premature, and the standard
references on the subject say that this can cause all sorts of unpleasant
things, including "fornication of camels and snakes." Thus your script
might suddenly find itself running under a Python interpreter rather than
a Perl interpreter when it returns to the present, which you can easily
see would be a disaster.
------------------------------
Date: Thu, 31 May 2001 07:41:52 +0200
From: buggs <buggs@geekmail.de>
Subject: Re: How Can abtain yesterday or nextday
Message-Id: <9f4lfi$kcj$07$1@news.t-online.com>
Eric Bohlman wrote:
> buggs <buggs@geekmail.de> wrote:
>> Eric Bohlman wrote:
>
>>> And getting yesterday's date is just as easy:
>>>
>>> sub yesterday's_date {
>>> sleep -86400;
>>> my $temp=localtime; #now it's yesterday
>>> sleep 86401; #return to tommorrow possibly losing a second
>>> $temp;
>>> }
>
>> return to today that is ;-)
>> otherwise today wouldn't exist
>
> But after the negative sleep, "today" is in fact tomorrow from the
> program's perspective.
>
> In case I didn't make it clear, the reason for the extra second on the
> second sleep is that if the clock rolled over during the call to
> localtime, the jump into the future might be premature, and the standard
> references on the subject say that this can cause all sorts of unpleasant
> things, including "fornication of camels and snakes." Thus your script
> might suddenly find itself running under a Python interpreter rather than
> a Perl interpreter when it returns to the present, which you can easily
> see would be a disaster.
>
>
Maybe you should use UNIVERSE::My.
Besides implementing nice handlers for
$SIG{COLLAPS} and such,
it has its own header file ( bof.h ) for user calls.
On UNIX machines it also gets
rid of real life mode.
Buggs
------------------------------
Date: Thu, 31 May 2001 12:55:59 +0800
From: "Kick" <mn_eric@email.com>
Subject: Re: How can I migirate installed&configured activeperl5.6 to another machine
Message-Id: <9f4im9$27b4o$1@ID-12869.news.dfncis.de>
Thanks you all!
And, shall I backup some regist entries?
Eric
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:22e9htkumj2irmdsltjll2f6cjtdjct86h@4ax.com...
> Eric Bohlman wrote:
>
> >GArlington <admin@ase-ga.com> wrote:
> >> Copy perl directory structure...
> >
> >Depending on your ActiveState version, you may also have to copy some
> >files (e.g. perlcrt.dll for the 500-series builds) which the installer
> >puts in /windows/system.
>
> I think that for 5.6, which is what the OP uses according to the subject
> line, all DLL's are in Perl's own "bin" directory.
>
> --
> Bart.
------------------------------
Date: Thu, 31 May 2001 02:33:11 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Modifying PM's
Message-Id: <comdog-BA2B04.02331131052001@news.panix.com>
In article <3B157040.2AAB6E7F@email.com>, Todd Anderson
<trashday@email.com> wrote:
> I just started working with perl modules. I downloaded a free script and
> I can't open the module in my text editor to modify it. I'm ussing MS
> Works for MAC. Any ideas?
use Alpha or BBEdit, which are text editors rather than word
processors.
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Thu, 31 May 2001 14:50:06 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Opinion on undef lvalue
Message-Id: <9f4pe6$42r@netnews.hinet.net>
Dear all,
Current version of Perl treats undef lvalue in this way:
sub foo :lvalue { undef }
foo = 'better';
died: Can't return a readonly value from lvalue subroutine at line 2.
IMHO, it is inconsistent with existing usage of undef lvalue.
($a,undef,$b) = ('good','better','best');
Here, the behavior of (undef) = 'better' is well defined (and won't die).
I suggest new version of Perl would follow the same logic to treat
"assignment to undef lvalue" as just an NOP. What do you think about it?
Thank you.
John Lin
--
salary('John') += 1000000;
sub salary :lvalue {
my $name = shift;
if(defined(my $employee = db_search($name))) { $employee->{salary} }
else { # this person doesn't work in our company at all!!!
undef; # NOP, no one's salary is increased
}
}
If the 'undef lvalue' is not available, what would you return for the case
when "this person doesn't work in our company" ?
------------------------------
Date: Thu, 31 May 2001 08:06:05 +0200
From: Philip Newton <pne-news-20010531@newton.digitalspace.net>
Subject: Re: Perl Community Stars (?)
Message-Id: <qinbhtcvsc7dngi8fjvjpcel9o4d9hcopv@4ax.com>
On Thu, 31 May 2001 02:39:45 +0200, buggs <buggs@geekmail.de> wrote:
> It tends to be easier to port the MIX
> examples to similar languages ( like C ).
> Higher languages leave more place for implementation.
> Thinking that's why he will use another language ( MMIX )
> in the future.
MMIX is also assembly-like, only it looks more like a modern RISC
assembly language than an old language that couldn't make up its mind
whether to be decimal or binary and whose "standard subroutine calling
convention was irrevocably based on self-modifying instructions!"
(Knuth). MMIX is not a high-level programming language, for similar
reasons as to why MIX was not.
Followups to poster.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Thu, 31 May 2001 02:36:27 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Perl Community Stars (?)
Message-Id: <comdog-6753B7.02362731052001@news.panix.com>
In article <thbg6n51hfbr56@corp.supernews.com>, Chris Stith
<mischief@velma.motion.net> wrote:
> I don't think it's true. I think one can do a fairly straight
> translation from MIX in Knuth to Perl, but I don't think that
> a _straight_ translation will be the _best_ translation much of
> the time.
there is a Perl module out there somewhere that can handle MIX.
i don't think it's on CPAN so i'll let the author pipe up if
he cares to let others know about it. ;)
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Thu, 31 May 2001 08:38:49 +0200
From: Philip Newton <pne-news-20010531@newton.digitalspace.net>
Subject: Re: Perl request
Message-Id: <h6obhtk22s067ks349slib12f3t0coc2u4@4ax.com>
On 30 May 2001 19:31:17 +0100, nobull@mail.com wrote:
> If this were Unix I'd say to do it in shell:
>
> cd /another/directory; rm `cd /one/directory; echo *`
Would this work for files with spaces in their names?
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 31 May 2001 04:30:39 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Rounding
Message-Id: <9f4hdf$keg$0@216.155.32.179>
In article <3B153E39.F10395CC@agilent.com>,
dave jerzycki <david_jerzycki@agilent.com> wrote:
| Is there any function or procedure within perl (5.0) to round?
| I can seem to locate any.
| I have two scalars I divide by to get a percentage.
| The figure comes out to 3.62509923334717
| I'd like it to be just 3.62
| use integer of course screws things up.
| I'm using the print function to print the data to a file, so I can't
| use any
| formating as in printf.
| Is there some other way around this?
|
|
other than the followups you've probably already seen, I once wrote my
own little variable rounding function out of sheer annoyance at the
problem. it's simple, and I've felt like re-doing it to be a little more
flexible, but here it is.
12:22am {1006} alaska:/home1/users/sgodin> cat round.pl
#!/usr/bin/perl -w
my @data;
push @data, (rand($_) + (rand($_) * 10)) for (1..10);
# had to write my own rounding routine since Perl doesn't come
# with one (per se), (as for some weird reason, Perl does a BASIC
# 'Fix' (aka 'truncate') instead of an 'rounded Int' for its int()
# function), then proceeded to specialize a tad to allow it to produce
# 0.5 results as well, for the purpose I required of it.
sub round
{
my $round = shift;
my $trunc = int($round);
my $diff = abs($round - $trunc);
if ($diff < 0.25) {return $trunc}
if ($diff >= 0.25 && $diff < 0.75) { return ($trunc + 0.5)}
return ++$trunc
}
print $_, "\t", round($_), "\n" for @data;
12:22am {1013} alaska:/home1/users/sgodin> perl round.pl
2.98598647722974 3
5.50459593441337 5.5
10.2275704457425 10
30.6529615279287 30.5
4.71874756040052 4.5
60.1747138397768 60
53.2522376026027 53.5
33.5798234753311 33.5
16.0852035605349 16
53.708800743334 53.5
You should be able to easily adapt this for your purpopse.
i.e.
...
if ($diff < 0.5) {return $trunc}
return ++$trunc
}
HTH
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Thu, 31 May 2001 06:48:14 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Rounding
Message-Id: <slrn9hbq9e.l25.abigail@tsathoggua.rlyeh.net>
dave jerzycki (david_jerzycki@agilent.com) wrote on MMDCCCXXIX September
MCMXCIII in <URL:news:3B153E39.F10395CC@agilent.com>:
""
"" Is there any function or procedure within perl (5.0) to round?
"" I can seem to locate any.
"" I have two scalars I divide by to get a percentage.
"" The figure comes out to 3.62509923334717
"" I'd like it to be just 3.62
"" use integer of course screws things up.
"" I'm using the print function to print the data to a file, so I can't
"" use any
"" formating as in printf.
"" Is there some other way around this?
""
Perhaps you should be using printf if you want to functionality of printf.
But I guess that would be to obvious.
Abigail
--
($;,$_,$|,$\)=("\@\x7Fy~*kde~box*Zoxf*Bkiaox","X"x25,1,"\r");
s/./ /;{vec($_=>1+$"=>8)=ord($/^substr$;=>$"=int rand 24=>1);
print&&select$,,$,,$,,$|/($|+tr/X//c);redo if y/X//};sleep 1;
------------------------------
Date: Thu, 31 May 2001 08:38:49 +0200
From: Philip Newton <pne-news-20010531@newton.digitalspace.net>
Subject: Re: Stripping a string down to aplhaNumeric characters/Using variables in Reg Expressions
Message-Id: <epnbhtsvra25hcnieroeoste3en2h9hgkn@4ax.com>
On Wed, 30 May 2001 23:37:53 -0200, "Steffen Moeller"
<not4u@somewhere.in.gl> top-posted:
> Would somebody please help me expand this statement to include the danish
> character represented by the html entity 'ø' ?
Sure, just include ø in the range; Perl is 8-bit clean.
(But realise that if you write your code on a Mac with MacRoman and read
in UTF-8 data, or on Windows in CP1252 "Western" and read in DOS CP437
data, or have other character set mismatch, the ø will not match what's
in the source, while ASCII is a subset of pretty much every character
set, EBCDIC excluded.)
> (This would make the statement multilingual :-) )
Swedes, Germans, French, and speakers of many other languages might
disagree. (Or even Danes, who would complain about missing å and
æ.)
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 31 May 2001 00:02:42 -0700
From: felan_66@hotmail.com (felan)
Subject: Substitution on .htm files
Message-Id: <a9a034fc.0105302302.560e2991@posting.google.com>
I tried to post this before but I have problems with Google so please
send me any reply by mail :) tnx
I am really not a programmer, and I dont really know anything about
perl, but I just need this one program. I have this code that prompts
for an input file and an output file then i substitutes a for b and x
for y in the given file and writes the result in another file:
print "Input file name: ";
chomp($infilename = <STDIN>);
print "Output file name: ";
chomp($outfilename = <STDIN>);
open(IN,$infilename) || die "cannot open $infilename for reading: $!";
undef($/);
{
local $/; # defaults to undef anyway
$text = <IN>;
}
$text =~ s{a}{b}gi;
$text =~ s{x}{y}gi;
open (OUT,">$outfilename") || die "cannot create $outfilename: $!";
print OUT $text;
close(IN);
close(OUT);
now I have a whole lot of files in a my /html directory where I would
like to to this operation on each .htm file and the result should go
to .html files (or better if I could replace the existing files) so
/html/first-file.htm --> /html/first-file.html
/html/second-file.htm --> /html/fsecond-file.html
etc.
or even better replace the existing files with the substitutions done
/html/first-file.htm --> /html/first-file.htm
/html/second-file.htm --> /html/second-file.htm
tnx
felan_66@hotmail.com
------------------------------
Date: Thu, 31 May 2001 02:28:58 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Unsure about headers
Message-Id: <comdog-A10490.02285831052001@news.panix.com>
In article <fSfR6.5254$25.18958@news1.eburwd1.vic.optushome.com.au>,
"Rob" <"relaxedrob@optushome.com.au"> wrote:
> Thanks you very much for the reply!
>
> <cut>
> > Unsure what any of this has to do with any concept that anyone usually
> > describes with the word 'headers'.
>
> This is why I titled the message "unsure". I am unsure whether my problem is to
> do with headers or not (but I suspected it was).
>
> <cut>
> > I think you are whitnessing the "sticky" behaviour of the CGI module.
> > This behaviour can be switched off on a per-field basis using the
> > '-force' parameter. For further details locate the documentation of
> > the -foece paramter.
> >
>
> Where can I find this documentation? :(
you will find the it in the documentation for the CGI module.
see the CGI Meta FAQ for the reference.
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Thu, 31 May 2001 02:31:41 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Unsure about headers
Message-Id: <comdog-5EBCCB.02314131052001@news.panix.com>
In article <UxfR6.5250$25.18979@news1.eburwd1.vic.optushome.com.au>,
"Rob" <"relaxedrob@optushome.com.au"> wrote:
> "brian d foy" <comdog@panix.com> wrote in message
> news:comdog-E2BA77.13031030052001@news.panix.com...
> > [please post your reply after the original text, as demonstrated here]
[reformatted]
> Unless the reply needs to directly quote any of the original text, the reply
> belongs above the original text. This is much easier to understand and precludes
> the user from having to scroll through a potentially large message to get to a
> potentially small reply.
you assume that everyone has already read everything that has come
before. this is simply not reality.
trim your post to the cite the relevant parts, then put your reply
closest to the statements to which they refer. this is easier to
understand.
the reply belongs in a logical order. this isn't jeapordy.
--
brian d foy <comdog@panix.com>
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: 31 May 2001 04:51:14 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: what does this mean?
Message-Id: <9f4ik2$keg$1@216.155.32.179>
In article <slrn9h91el.2s4.bernard.el-hagin@gdndev25.lido-tech>,
bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
| On Tue, 29 May 2001 16:55:53 GMT, Todd Smith <todd@designsouth.net> wrote:
| >
| >"Mark Jason Dominus" <mjd@plover.com> wrote in message
| >news:3b0bbb9b.510b$1c3@news.op.net...
| >> In article <slrn9gmu2s.91g.vek@pharmnl.ohout.pharmapartners.nl>,
| >> Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl> wrote:
| >> >I wonder: why do a web search if the documentation and manuals are all
| >> >installed locally?
| >>
| >> Why post to usenet if the manuals are all installed locally?
| >>
| >
| >Why wash my car when it's going to rain some time in the future?
|
| Hardly equivalent.
|
Why bother responding when someone's just going to carp about my
response anyway?
(:
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.
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 V10 Issue 1025
***************************************