[25464] in Perl-Users-Digest
Perl-Users Digest, Issue: 7709 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 29 18:05:23 2005
Date: Sat, 29 Jan 2005 15:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 29 Jan 2005 Volume: 10 Number: 7709
Today's topics:
Re: [perl-python] 20050127 traverse a dir <jerf@jerf.org>
Re: getting {string} from \${string} <joe@inwap.com>
Re: getting {string} from \${string} <noreply@gunnar.cc>
Google AdSense API <founder@pege.org>
Message body <nospam@cdtoday.co.uk>
Re: Message body <1usa@llenroc.ude.invalid>
Re: Message body <nospam@cdtoday.co.uk>
Re: Message body <spamtrap@dot-app.org>
Re: Message body <1usa@llenroc.ude.invalid>
Re: Perl loops should use break, not last <perl@my-header.org>
Re: Perl loops should use break, not last <1usa@llenroc.ude.invalid>
Re: Perl loops should use break, not last <ask@me.com>
Re: Perl loops should use break, not last <ask@me.com>
Re: Perl loops should use break, not last <gargoyle@no.spam>
Re: Perl loops should use break, not last (Anno Siegel)
Re: Perl loops should use break, not last <flavell@ph.gla.ac.uk>
Re: Perl loops should use break, not last (Anno Siegel)
Re: Print question <joe@inwap.com>
Re: Regular Expression Question on /i amyl@paxemail.com
Re: Regular Expression Question on /i <nospam-abuse@ilyaz.org>
Re: remove junk characters <antbyte.The.Flow@gmail.com>
Re: remove junk characters <kjetilskotheim@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 29 Jan 2005 14:26:56 -0500
From: Jeremy Bowers <jerf@jerf.org>
Subject: Re: [perl-python] 20050127 traverse a dir
Message-Id: <pan.2005.01.29.19.26.55.598638@jerf.org>
On Thu, 27 Jan 2005 15:01:12 -0500, Chris Mattern wrote:
> Is it just me, or is the disappointing lack of flamewars
> slowly ratcheting up the level of vitriol in his posts?
What flabbergasts me is the stunning failure in trolling that XL is.
I've accidentally trolled (if you can extend the trolling definition that
way) through ignorance of both subject matter and local culture,
accidentally trolled through typo, and accidentally trolled through poorly
chosen incendiary example that had little to do with my point.
This poor guy trolls across five newsgroups and is now one of the few
things that they absolutely all absolutely agree on.
Now *that* is some truly breathtaking failure right there. I'm not sure I
could fail that hard if I tried.
(I'll shut up about Xah now.)
------------------------------
Date: Sat, 29 Jan 2005 08:22:59 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: getting {string} from \${string}
Message-Id: <7NmdnU0utIL5JWbcRVn-rA@comcast.com>
jl_post@hotmail.com wrote:
> jl_post@hotmail.com wrote:
>
>>(You can easily modify the printVar() function to
>>handle multiple variables, if you wish.)
>
>
>
> Such as:
>
> sub printVar { print "\$$_ = ", eval "\$$_", "\n" for @_ }
>
>
> Then you can call it like:
>
> my $wow = 5;
> my $var = "hello";
> printVar qw(wow var);
>
> And you'll see the output:
>
> $wow = 5
> $var = hello
No, you will not!
You'll see the output
$wow =
$var =
because variables declared with my() are not visible outside
there scope.
Did you even try running the code you posted?
-Joe
------------------------------
Date: Sat, 29 Jan 2005 18:07:45 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: getting {string} from \${string}
Message-Id: <361ucaF4q62jgU1@individual.net>
Joe Smith wrote:
> jl_post@hotmail.com wrote:
>> jl_post@hotmail.com wrote:
>>> (You can easily modify the printVar() function to
>>> handle multiple variables, if you wish.)
>>
>> Such as:
>>
>> sub printVar { print "\$$_ = ", eval "\$$_", "\n" for @_ }
>>
>> Then you can call it like:
>>
>> my $wow = 5;
>> my $var = "hello";
>> printVar qw(wow var);
>>
>> And you'll see the output:
>>
>> $wow = 5
>> $var = hello
>
> No, you will not!
>
> You'll see the output
> $wow =
> $var =
> because variables declared with my() are not visible outside
> there scope.
You will see the former output with:
my $wow = 5;
my $var = "hello";
sub printVar { print "\$$_ = ", eval "\$$_", "\n" for @_ }
printVar qw(wow var);
i.e. if the sub is defined
1) within the same scope as, *and*
2) after
the variables.
But it's not an appropriate solution to the OP's problem.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 29 Jan 2005 20:05:49 +0100
From: =?Windows-1252?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Google AdSense API
Message-Id: <41fbf5ed$0$29872$91cee783@newsreader01.highway.telekom.at>
Has anybody created applications
for the Google AdSense API?
--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine
------------------------------
Date: Sat, 29 Jan 2005 21:43:58 GMT
From: "Antony" <nospam@cdtoday.co.uk>
Subject: Message body
Message-Id: <ysTKd.207$IZ4.179@newsfe3-win.ntli.net>
Hi,
I am trying to read an email into an array, using the POP method. However I
can read each of the lines using if($line =~ m/Subject: /) { (as the subject
for example), but how do I read the main email content/topic/body into an
array, as it doesnt appear to have a header title.
thanks
Antony
(This email has been checked
by Norton Antivirus 2004)
www.cdtoday.co.uk
------------------------------
Date: Sat, 29 Jan 2005 22:20:11 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Message body
Message-Id: <Xns95EDB0659F5D3asu1cornelledu@127.0.0.1>
"Antony" <nospam@cdtoday.co.uk> wrote in
news:ysTKd.207$IZ4.179@newsfe3-win.ntli.net:
> I am trying to read an email into an array, using the POP method.
> However I can read each of the lines using if($line =~ m/Subject: /) {
> (as the subject for example), but how do I read the main email
> content/topic/body into an array, as it doesnt appear to have a header
> title.
CPAN is your friend. You can use Mail::POP3Client. Specifically, the Body
method is what you are looking for. You can find the module at:
http://search.cpan.org/~sdowd/Mail-POP3Client-2.16/
Shamless plug: I have grown quite fond of Mail::POP3Client. There is a
short script that I find useful (and illustrates the use of the module) at
<http://www.unur.com/comp/delspam_pl.txt>.
Sinan.
------------------------------
Date: Sat, 29 Jan 2005 22:30:28 GMT
From: "Antony" <nospam@cdtoday.co.uk>
Subject: Re: Message body
Message-Id: <88UKd.299$IZ4.66@newsfe3-win.ntli.net>
Hi
Thanks for your reply. I was however hoping to use Net::POP3 module as the
basis, because the script is already formatted for this. Does the POP3Client
need any different scripting?
Antony
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns95EDB0659F5D3asu1cornelledu@127.0.0.1...
> "Antony" <nospam@cdtoday.co.uk> wrote in
> news:ysTKd.207$IZ4.179@newsfe3-win.ntli.net:
>
>> I am trying to read an email into an array, using the POP method.
>> However I can read each of the lines using if($line =~ m/Subject: /) {
>> (as the subject for example), but how do I read the main email
>> content/topic/body into an array, as it doesnt appear to have a header
>> title.
>
> CPAN is your friend. You can use Mail::POP3Client. Specifically, the Body
> method is what you are looking for. You can find the module at:
>
> http://search.cpan.org/~sdowd/Mail-POP3Client-2.16/
>
> Shamless plug: I have grown quite fond of Mail::POP3Client. There is a
> short script that I find useful (and illustrates the use of the module) at
>
> <http://www.unur.com/comp/delspam_pl.txt>.
>
> Sinan.
------------------------------
Date: Sat, 29 Jan 2005 17:53:38 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Message body
Message-Id: <fL2dneKG6Y9ujmHcRVn-vg@adelphia.com>
(Upside-down quoting rearranged - please don't do that.)
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns95EDB0659F5D3asu1cornelledu@127.0.0.1...
>>
>> <http://www.unur.com/comp/delspam_pl.txt>.
Antony wrote:
> Thanks for your reply. I was however hoping to use Net::POP3 module as the
> basis, because the script is already formatted for this. Does the
> POP3Client need any different scripting?
Didn't you look at the example A. Sinan gave you?
Obviously, POP3Client is different, but using it should be just a simple
matter of a changing a few method calls. It's not like you'd have to start
over, and rewrite your whole script in FORTRAN or something. ;-)
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 29 Jan 2005 22:55:18 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Message body
Message-Id: <Xns95EDB6595C871asu1cornelledu@127.0.0.1>
"Antony" <nospam@cdtoday.co.uk> wrote in
news:88UKd.299$IZ4.66@newsfe3-win.ntli.net:
[ Top-posting fixed. Please don't do that. ]
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns95EDB0659F5D3asu1cornelledu@127.0.0.1...
>> "Antony" <nospam@cdtoday.co.uk> wrote in
>> news:ysTKd.207$IZ4.179@newsfe3-win.ntli.net:
>>
>>> I am trying to read an email into an array, using the POP method.
>>> However I can read each of the lines using if($line =~ m/Subject: /)
>>> { (as the subject for example), but how do I read the main email
>>> content/topic/body into an array, as it doesnt appear to have a
>>> header title.
>>
>> CPAN is your friend. You can use Mail::POP3Client. Specifically, the
>> Body method is what you are looking for. You can find the module at:
>>
>> http://search.cpan.org/~sdowd/Mail-POP3Client-2.16/
...
> Thanks for your reply. I was however hoping to use Net::POP3 module as
> the basis, because the script is already formatted for this. Does the
> POP3Client need any different scripting?
The reason I mentioned Mail::POP3Client is because you did not
originally mention any modules.
You can find out the differences in the two modules by reading their
documentation. I do not know what you are trying to do, so it is hard
for me to recommend ditching Net::POP3.
At this point, you might want to read the posting guidelines for this
group to see how you can help others help you.
Sinan.
------------------------------
Date: Sat, 29 Jan 2005 17:06:52 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: Perl loops should use break, not last
Message-Id: <dmcnv0tclggthkelp49b0uf0fj50uiv6o8@4ax.com>
X-Ftn-To: Jeremy Morton
"Jeremy Morton" <ask@me.com> wrote:
>Probably been mentioned before but I fail to see why Perl changed the
>'break' keyword to 'last', in loops. Bear with me on this - it seems
>semantically more accurate to say 'break' - you're immediately breaking out
>of the loop. 'last' makes it sound like the current loop will be the last,
>but not that the execution should be stopped immediately, whereas break
>makes it sound like the latter.
I'm guessing, "last" was picked because it's short and it sounds good along
with "next". Further, "break" could blur things for C people as his
"continue" friend is already used for something else.
[crosspost trimmed]
--
Matija
------------------------------
Date: Sat, 29 Jan 2005 16:14:22 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl loops should use break, not last
Message-Id: <Xns95ED725F9AE55asu1cornelledu@127.0.0.1>
"Jeremy Morton" <ask@me.com> wrote in
news:41fbaeb9$0$26027$fa0fcedb@news.zen.co.uk:
[ Removed comp.lang.perl from newsgroups list ]
> Probably been mentioned before but I fail to see why Perl changed the
> 'break' keyword to 'last', in loops. Bear with me on this - it seems
> semantically more accurate to say 'break' -
I have a sneaking suspicion that you are trolling, but I will indulge
you anyway. You can think of 'last' as 'this is the last statement to be
excuted in this loop'. At least, that is why it made sense to me the
first time I started learning Perl.
> 'last' makes it sound like the current loop will be the last,
Your terminology is odd. How can the current loop be the last? How could
a statement in one loop affect whether or not other loops are excuted?
Are you saying, if I have:
my @animals = qw(cat dog dino);
for my $animal (@animals) {
last if $animal eq 'dog';
}
for my $animal (@animals) {
print uc $animal, "\n";
}
The second loop will not be excuted due to the 'last' statement in the
first loop.
I am going to recommend a visit to http://learn.perl.org/ as well as
reading perldoc -f last.
Hope this helps.
Sinan.
------------------------------
Date: Sat, 29 Jan 2005 16:29:57 -0000
From: "Jeremy Morton" <ask@me.com>
Subject: Re: Perl loops should use break, not last
Message-Id: <41fbb9c0$0$7779$db0fefd9@news.zen.co.uk>
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> "Jeremy Morton" <ask@me.com> wrote in
> news:41fbaeb9$0$26027$fa0fcedb@news.zen.co.uk:
>
> [ Removed comp.lang.perl from newsgroups list ]
>
>> Probably been mentioned before but I fail to see why Perl changed the
>> 'break' keyword to 'last', in loops. Bear with me on this - it seems
>> semantically more accurate to say 'break' -
>
> I have a sneaking suspicion that you are trolling, but I will indulge
Why does every genuine question to a Usenet group have to be a troll? See
this is why I don't often post on bloody Usenet.
> you anyway. You can think of 'last' as 'this is the last statement to
> be excuted in this loop'. At least, that is why it made sense to me
> the first time I started learning Perl.
Yes, that is the only way you can think about it validly. My point is that
if 'next' is to mean 'execute the next iteration of this loop', it seems
more natural for 'last' to mean 'make this the last iteration of this loop'
as opposed to 'make this the last statement of this loop'. On the other
hand, 'break' does sound natural as you're breaking out of the loop
immediately by making this the last statement.
>
>> 'last' makes it sound like the current loop will be the last,
>
> Your terminology is odd. How can the current loop be the last? How
> could a statement in one loop affect whether or not other loops are
> excuted?
You misunderstood, see above. I meant the last iteration.
--
Best regards,
Jeremy Morton (Jez)
------------------------------
Date: Sat, 29 Jan 2005 16:38:29 -0000
From: "Jeremy Morton" <ask@me.com>
Subject: Re: Perl loops should use break, not last
Message-Id: <41fbbbc0$0$26014$fa0fcedb@news.zen.co.uk>
Matija Papec <perl@my-header.org> wrote:
> X-Ftn-To: Jeremy Morton
>
> "Jeremy Morton" <ask@me.com> wrote:
>> Probably been mentioned before but I fail to see why Perl changed the
>> 'break' keyword to 'last', in loops. Bear with me on this - it seems
>> semantically more accurate to say 'break' - you're immediately
>> breaking out of the loop. 'last' makes it sound like the current
>> loop will be the last, but not that the execution should be stopped
>> immediately, whereas break makes it sound like the latter.
>
> I'm guessing, "last" was picked because it's short and it sounds good
> along with "next".
That's a good reason to choose a keyword, because it 'sounds good'? Heh.
It doesn't make semantic sense, and that's far more important IMHO.
> Further, "break" could blur things for C people as
> his "continue" friend is already used for something else.
Yes, I don't quite understand why 'continue' is used the way it is,
either... that doesn't make much sense. However i'd still rather have
'break' meaning what it does in most other languages i've come across. You
don't even have to do away with 'last'... just alias break to mean the same
thing.
--
Best regards,
Jeremy Morton (Jez)
------------------------------
Date: Sat, 29 Jan 2005 17:08:28 GMT
From: gargoyle <gargoyle@no.spam>
Subject: Re: Perl loops should use break, not last
Message-Id: <gqPKd.1871$dj6.1355@bignews1.bellsouth.net>
On 2005-01-29, Matija Papec <perl@my-header.org> wrote:
> I'm guessing, "last" was picked because it's short and it sounds good along
> with "next". Further, "break" could blur things for C people as his
> "continue" friend is already used for something else.
One thing from C that'd be really useful is to do away with the required
braces in one-line if/then/else blocks, like this:
if ($foo)
func1($foo);
elsif ($bar)
func2($bar, $z);
else
return;
I don't know if somebody already suggested this for Perl 6, but I think
it'd be a nice improvement. That and a real switch statement. :-)
------------------------------
Date: 29 Jan 2005 17:51:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl loops should use break, not last
Message-Id: <ctgif2$seo$1@mamenchi.zrz.TU-Berlin.DE>
[defunct newsgroup comp.lang.perl trimmed]
Jeremy Morton <ask@me.com> wrote in comp.lang.perl.misc:
> Probably been mentioned before but I fail to see why Perl changed the
> 'break' keyword to 'last', in loops. Bear with me on this - it seems
> semantically more accurate to say 'break' - you're immediately breaking out
> of the loop. 'last' makes it sound like the current loop will be the last,
> but not that the execution should be stopped immediately, whereas break
> makes it sound like the latter.
It makes perfect sense when you name the loops appropriately:
line: while ( <DATA> ) {
next line if /^\s*#/;
chomp;
last line if $_ eq '__END__';
# ...
}
What could be clearer? That's the idea behind "next" and "last", even
if the label is not present.
> Where can I propose that this be changed, or break aliased to last, for Perl
> 6?
I don't believe that's still open for discussion. Look for something
appropriate at http://dev.perl.org/perl6/lists/ if you want to try anyway.
Anno
------------------------------
Date: Sat, 29 Jan 2005 18:18:46 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Perl loops should use break, not last
Message-Id: <Pine.LNX.4.61.0501291804180.24715@ppepc56.ph.gla.ac.uk>
On Sat, 29 Jan 2005, A. Sinan Unur wrote:
> "Jeremy Morton" <ask@me.com> wrote in
> > semantically more accurate to say 'break' -
>
> I have a sneaking suspicion that you are trolling,
I think you're being rather uncharitable. As far as I recall, "break"
/was/ the term used in BCPL for effectively the same purpose:
| causes execution to be resumed at the point just after
| the smallest textually enclosing loop command
it says in the old manual.
But the Perl usage is now well established, and the other arguments
on this thread are well taken. I doubt there's anything to be gained
by trying to change the Perl usage now, and I don't see any net
benefit in it.
all the best
------------------------------
Date: 29 Jan 2005 18:25:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl loops should use break, not last
Message-Id: <ctgkfb$ml$1@mamenchi.zrz.TU-Berlin.DE>
Jeremy Morton <ask@me.com> wrote in comp.lang.perl.misc:
> A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> > "Jeremy Morton" <ask@me.com> wrote in
> > news:41fbaeb9$0$26027$fa0fcedb@news.zen.co.uk:
> >
> > [ Removed comp.lang.perl from newsgroups list ]
> >
> >> Probably been mentioned before but I fail to see why Perl changed the
> >> 'break' keyword to 'last', in loops. Bear with me on this - it seems
> >> semantically more accurate to say 'break' -
> >
> > I have a sneaking suspicion that you are trolling, but I will indulge
>
> Why does every genuine question to a Usenet group have to be a troll? See
> this is why I don't often post on bloody Usenet.
Take it or leave it.
> > you anyway. You can think of 'last' as 'this is the last statement to
> > be excuted in this loop'. At least, that is why it made sense to me
> > the first time I started learning Perl.
>
> Yes, that is the only way you can think about it validly. My point is that
> if 'next' is to mean 'execute the next iteration of this loop', it seems
> more natural for 'last' to mean 'make this the last iteration of this loop'
> as opposed to 'make this the last statement of this loop'.
You mean, the loop body continues to the final "}" before the loop
ends, like a delayed break? That's an interpretation I wouldn't
have thought of, just because it would be a rather awkward behavior.
(If you need the behavior, you can have it with the current working
of "last", but not easily the other way around.)
To me, "last" means last, enough, quit. Just like "next", it leaves
the normal sequence of execution immediately. Your interpretation
seems overly literal-minded and artificial to me.
> On the other
> hand, 'break' does sound natural as you're breaking out of the loop
> immediately by making this the last statement.
Only if you are already accustomed to its specific usage in C. "Break
out" isn't the first thing that comes to mind when I see "break" without
context. The step from the everyday meaning of "break" to the C-specific
one is no shorter than it is from the everyday "last" to the Perl-specific
meaning.
Anno
------------------------------
Date: Sat, 29 Jan 2005 08:16:28 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Print question
Message-Id: <7NmdnVIutIJDK2bcRVn-rA@comcast.com>
edgrsprj wrote:
> Thanks for the comments. Back about 5 years ago I wrote a CGI program using
> some version of Perl. And it ran automatically on this one an Internet
> server for about a year. I don't recall exactly what the code looked like.
> But if I remember correctly it was somewhat different than the version of
> Perl that I am presently running on my PC.
Perl version 4 was what I had to use when I wrote my first CGI program.
The web server was a PC - a personal computer running FreeBSD.
You can definitely say that perl version 5 is "somewhat different"
than perl version 4.
The version of perl I'm running on Windows XP is the exact same
language as what I run on Linux, FreeBSD, Solaris and cygwin.
The Apache web server now comes with modules to reduce the overhead
of starting up a perl interpreter when running a CGI program.
There are some programming conventions that you need to be aware
of when using mod_perl under Apache, but it is the same language
is what you run on a PC.
-Joe
------------------------------
Date: 29 Jan 2005 08:32:05 -0800
From: amyl@paxemail.com
Subject: Re: Regular Expression Question on /i
Message-Id: <1107016325.195879.143390@z14g2000cwz.googlegroups.com>
Thank you so much. I had no idea about "perldoc".
Amy
------------------------------
Date: Sat, 29 Jan 2005 22:55:48 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Regular Expression Question on /i
Message-Id: <cth49k$15qk$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Tad McClellan
<tadmc@augustmail.com>], who wrote in article <slrncvn54e.6vb.tadmc@magna.augustmail.com>:
> > \b(?:college|university)\s+diplomas/i
>
>
> The "i" is not in a regular expression there, the "i" is part
> of an *operator* that makes use of regular expressions.
Actually, it is in a regular expression; so are 'x', 's' and 'm'.
Hope this helps,
Ilya
------------------------------
Date: 29 Jan 2005 11:42:11 -0800
From: "The Flow" <antbyte.The.Flow@gmail.com>
Subject: Re: remove junk characters
Message-Id: <1107027731.730359.309270@z14g2000cwz.googlegroups.com>
kums,
Would you mind showing the script and the junk characters? That would
enable people to help you a lot more specifically.
Thanks,
The Flow
------------------------------
Date: Sat, 29 Jan 2005 22:03:03 +0100
From: "Kjetil Skotheim" <kjetilskotheim@yahoo.com>
Subject: Re: remove junk characters
Message-Id: <opsldt3dqptm9jxl@edelweiss.upc.no>
On Sat, 29 Jan 2005 01:59:30 -0500, kums <bckumari@yahoo.com> wrote:
> hi,
> I have extracted contents from tamil webpage and stored into one file.
> While doing some process on this file,some extra
> junk characters are stored inbetween the tamil text.
> how to remove these junk characters?
>
Store this in a dejunk.pl file:
$notjunk="abcdef ..."; #chars that is not junk
%notjunk=map{($_,1)}split//,$notjunk;
while(<>){
s/(.)/$notjunk{$1}?$1:""/ges;
print;
}
Then run:
perl dejunk.pl < file.txt > newfile.txt
--
Kjetil Skotheim
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7709
***************************************