[19128] in Perl-Users-Digest
Perl-Users Digest, Issue: 1323 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 18 06:11:12 2001
Date: Wed, 18 Jul 2001 03:10:12 -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: <995451012-v10-i1323@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 18 Jul 2001 Volume: 10 Number: 1323
Today's topics:
Re: perl regular expression grammar <pne-news-20010718@newton.digitalspace.net>
Playing MP3s with Perl under Win32 (Francois VALDY)
Re: Pull ng posts behind firewall <pne-news-20010718@newton.digitalspace.net>
Re: Pull ng posts behind firewall (BUCK NAKED1)
puzzle with 'if' statement <terence@nospam.hotbot.com>
Re: puzzle with 'if' statement <terence@nospam.hotbot.com>
Re: puzzle with 'if' statement (Tim Hammerquist)
Re: puzzle with 'if' statement <terence@nospam.hotbot.com>
Re: Regex question <joe@digital-hippy.com>
Re: Replacing a specific line (mc)
Re: Replacing a specific line (Logan Shaw)
Re: skipping a duplicate <kistler@gmx.net>
Strange thing happened today! <millettNOSPAM@lblueyonder.co.uk>
Re: The /e switch for regexp (Randal L. Schwartz)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Jul 2001 08:43:42 +0200
From: Philip Newton <pne-news-20010718@newton.digitalspace.net>
Subject: Re: perl regular expression grammar
Message-Id: <bl7alt0dbkmfn64spumj60s9qk2258k89s@4ax.com>
[comp.compilers removed]
On 17 Jul 2001 23:28:53 -0400, alan@oursland.net (Alan Oursland) wrote:
> One area I am confused is the "\c[" control character (described at
> http://www.perldoc.com/perl5.6/pod/perlre.html). How does this work?
"\c[" is just "\033" or "\x1B", the ESC character. You can also spell it
"\e" if you want. What do you mean, how does this work?
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: 18 Jul 2001 00:58:17 -0700
From: francois.valdy@supelec.fr (Francois VALDY)
Subject: Playing MP3s with Perl under Win32
Message-Id: <295df0d0.0107172358.2d574a46@posting.google.com>
Everything is in the subject,
the last version of MPEG::MP3Play I found (Jan 2001) does not support
Win32, even if the library it relies on (xaudio) works on windows.
has anyone managed to play mp3 under windows in perl (and not with
sending messages to winamp or alike) ?
------------------------------
Date: Wed, 18 Jul 2001 07:05:04 +0200
From: Philip Newton <pne-news-20010718@newton.digitalspace.net>
Subject: Re: Pull ng posts behind firewall
Message-Id: <gs4altgk54gcio3ujvpb30jei89lh267ip@4ax.com>
On Wed, 18 Jul 2001 02:00:10 GMT, "What A Man !" <whataman@home.com>
wrote:
> Philip Newton wrote:
> >
> > You need to find a news server that carries that newsgroup and that
> > allows you to read. If you have such a server, and can connect to it
> > with Net::NNTP, then you can use it.
> >
> Thanks. How do I find out if a news service can connect to my newsgroup?
Er, I think you're asking the wrong question. Many news servers could
have access to certain newsgroups if they wanted to but choose not to
carry them. The news server I use, for example, has none of
alt.binaries.* -- though they could almost certainly get a feed from one
of their many peers if they wanted to. So the question is not whether
the news server *is able to* access the newsgroup, but whether it
carries it (that is, whether it receives posts sent to that newsgroup
from its peering partners).
To find out, you could contact the server's administrator, read the FAQ
for the server, or connect to the server with a newsreader and see what
it says the carried newsgroups are. Or talk NNTP to it and ask it for
its active file.
Did you already have a specific news server in mind that you wanted to
follow the group on?
> I looked at a newsreader program named KWEST. Is this an easy newsgroup
> reader or is it easier just to use the Net::NNTP module or MIT's
> Mail2News Program?
Never heard of it (and this place may not be the best place to ask that
particular question).
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: Wed, 18 Jul 2001 01:59:13 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Pull ng posts behind firewall
Message-Id: <27315-3B5533C1-126@storefull-241.iap.bryant.webtv.net>
Thanks Phillip. I did some research, and found out that WebTV uses
password and username authentication which doesn't make sense to me
since I can log on with or without a password. I also found out that it
uses PPP to initiate a PPL connection, whatever those things are. Guess
I'll just screw around with the Net:NNTP module and see what happens,
though I have no idea what I'm doing.
In my research, I did come across one of R Schwartz's NNTP daemon
scripts that may help.
Regards,
--Dennis (aka whataman@home.com)
------------------------------
Date: Wed, 18 Jul 2001 15:01:13 +0800
From: "Terence" <terence@nospam.hotbot.com>
Subject: puzzle with 'if' statement
Message-Id: <9j3cd1$kr5$1@dahlia.singnet.com.sg>
I'm new to Perl.
Can someone help me?
#!/usr/bin/perl
$vara="12345678Z";
if($vara != '12345678Z'){
print "$vara is in if loop\n";
}
$varb="T2345678Z";
if($varb != ' '){
print "$varb is in if loop\n";
}
The result is "12345678Z is in if loop" but T2345678Z is not.
Why isn't T2345678Z in the if loop?
Thanks and regards
------------------------------
Date: Wed, 18 Jul 2001 15:02:49 +0800
From: "Terence" <terence@nospam.hotbot.com>
Subject: Re: puzzle with 'if' statement
Message-Id: <9j3cg1$kja$1@dahlia.singnet.com.sg>
Sorry, typo. Should be :
I'm new to Perl.
Can someone help me?
#!/usr/bin/perl
$vara="12345678Z";
if($vara != ' '){
print "$vara is in if loop\n";
}
$varb="T2345678Z";
if($varb != ' '){
print "$varb is in if loop\n";
}
The result is "12345678Z is in if loop" but T2345678Z is not.
Why isn't T2345678Z in the if loop?
Thanks and regards
------------------------------
Date: Wed, 18 Jul 2001 07:10:28 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: puzzle with 'if' statement
Message-Id: <slrn9lae90.lhu.tim@vegeta.ath.cx>
Me parece que Terence <terence@nospam.hotbot.com> dijo:
> I'm new to Perl.
>
> Can someone help me?
>
> #!/usr/bin/perl
> $vara="12345678Z";
> if($vara != '12345678Z'){
> print "$vara is in if loop\n";
> }
[ snip ]
>
> The result is "12345678Z is in if loop" but T2345678Z is not.
> Why isn't T2345678Z in the if loop?
Perl has separate equality operators for strings and numbers. != is the
inequality op for _numbers_. The ineq op for strings is 'ne'. eg:
$if ($vara ne '12345678Z') {
...
}
$string ne 'string'
$number != 12345678
$string eq 'string'
$number == 12345678
and so on.
See `perldoc perlop` for more.
--
We're dumber than squirrels. We hear voices and do
what they command. I have broccoli in my socks.
-- Dilbert's boss
------------------------------
Date: Wed, 18 Jul 2001 15:24:32 +0800
From: "Terence" <terence@nospam.hotbot.com>
Subject: Re: puzzle with 'if' statement
Message-Id: <9j3dos$l2t$1@dahlia.singnet.com.sg>
Oh I see. Thanks for your help.
Terence.
"Tim Hammerquist" <tim@vegeta.ath.cx> wrote in message
news:slrn9lae90.lhu.tim@vegeta.ath.cx...
> Me parece que Terence <terence@nospam.hotbot.com> dijo:
> > I'm new to Perl.
> >
> > Can someone help me?
> >
> > #!/usr/bin/perl
> > $vara="12345678Z";
> > if($vara != '12345678Z'){
> > print "$vara is in if loop\n";
> > }
> [ snip ]
> >
> > The result is "12345678Z is in if loop" but T2345678Z is not.
> > Why isn't T2345678Z in the if loop?
>
> Perl has separate equality operators for strings and numbers. != is the
> inequality op for _numbers_. The ineq op for strings is 'ne'. eg:
>
> $if ($vara ne '12345678Z') {
> ...
> }
>
> $string ne 'string'
> $number != 12345678
>
> $string eq 'string'
> $number == 12345678
>
> and so on.
>
> See `perldoc perlop` for more.
> --
> We're dumber than squirrels. We hear voices and do
> what they command. I have broccoli in my socks.
> -- Dilbert's boss
------------------------------
Date: Wed, 18 Jul 2001 08:04:53 +0100
From: "joe higton" <joe@digital-hippy.com>
Subject: Re: Regex question
Message-Id: <Aza57.45857$WS4.7068155@news6-win.server.ntlworld.com>
In article <3B4F71E4.591AA2B9@sequenom.com>, "BCC" <bcoon@sequenom.com>
wrote:
> How do I begin a match starting at a certain position?
>
> For example, if I have:
> $s = "ABC DEF GHI JKL";
My "hack and slash" answer to that would be to say match anything '.'
for the characters before e.g
$s =~ /......GHI/
There HAS to be a better way but hey this should work.
JOe
------------------------------
Date: Wed, 18 Jul 2001 04:08:29 GMT
From: nospam@home.com (mc)
Subject: Re: Replacing a specific line
Message-Id: <3b550b57.388993515@news>
On Tue, 17 Jul 2001 23:35:41 +0100, James Coupe <james@zephyr.org.uk>
wrote:
>In message <3b54ace7.364814287@news>, mc <nospam@home.com> writes
>>> if ($memsettings[($i-1)] != '') {
>>> print FILE "$memsettings[($i-1)]\n";
>>> } else {
>>> print FILE "\n";
>>> }
>>>
>>
>>Is this your actual code? You're missing a closing double quote in
>>the first line above but I'd think this wouldn't get past the
>>compiler.
>
>The first line has two single quotes.
Oops. Sorry about that. In this font (MS Sans Serif), the two
single quotes look closer together than the marks in a single
double-quote!
------------------------------
Date: 18 Jul 2001 00:28:02 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Replacing a specific line
Message-Id: <9j36p2$qu2$1@charity.cs.utexas.edu>
In article <3b550b57.388993515@news>, mc <nospam@home.com> wrote:
>Oops. Sorry about that. In this font (MS Sans Serif), the two
>single quotes look closer together than the marks in a single
>double-quote!
Really? Apparently, your newsreading software allows you to read
Usenet with a proportional font without even warning you of that
fact. I suggest getting new newsreading software, as the authors
of whatever you're using don't seem to know much about Usenet.
- Logan
--
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)
------------------------------
Date: Wed, 18 Jul 2001 08:56:57 +0200
From: Per Kistler <kistler@gmx.net>
To: Troy Lachinski <troylachinski@my-deja.com>
Subject: Re: skipping a duplicate
Message-Id: <3B553339.39C717E8@gmx.net>
Hi Troy
Maybe that helps:
------------------------Code-------
#!/usr/bin/perl
use strict;
my @first;
my %seen;
while( my $line = <DATA> ){
chomp $line;
next unless length($line) == 6;
my $a = substr($line,0,4);
my $b = substr($line,3,3);
print "First: $a\n";
print "Second: $b\n" unless exists $seen{$b};
$seen{$b}++;
}
__DATA__
ABC123
BCD234
EFG345
HIJ123
KLM235
NOP234
QRS124
--------------End code----------------
Per Kistler.
Troy Lachinski wrote:
>
> Thanks in advance for any help given. I would be happy with a point
> in the right direction. I have read the FAQ and several hundred
> (somewhat) related posts.
>
> I have a file that contains information about inventory items. I need
> to split this information into 2 files. The first file is a PLU file,
> I will have one line of information in the [PLU FILE output] for each
> line in the input file. The [PPY FILE output] is a secondary
> information file where duplicates are not allowed.
>
> sample input:
> ABC123
> BCD234
> EFG345
> HIJ123
> KLM235
> NOP234
> QRS124
>
> wanted output:
>
> PLU FILE: PPY FILE:
> ABC1 123
> BCD2 234
> EFG3 345
> HIJ1 235
> KLM4 124
> NOP2
> QRS5
--
Per Kistler, kistler@gmx.net
------------------------------------------------------------------
------------------------------
Date: Wed, 18 Jul 2001 03:44:25 GMT
From: "millside" <millettNOSPAM@lblueyonder.co.uk>
Subject: Strange thing happened today!
Message-Id: <tC757.11608$FC5.1287277@news1.cableinet.net>
Hello,
Thought I'd share this one..
Finally debugged and uploaded my newest baby to the linux box and did a test
routine on the perl prog.
The program ran ok and displayed correctly in IE5 browser. And what the
$*!/:@$5&* did I see? Within a split second of the display my login screen
asking for the username/pass to my protected directory huh?
Yes that's right... the content was displayed, and then the login!
Permissions were set correctly -check
Normal parsing with standard input/output -check
No funny coding (well..at least I don't think so anyway!) -check
No includes/requires, just one simple .cgi and a flat file -check
No syntax errors -check
No software errors -check
No server errors -check
Hmm...
Been checking everything over but drawn a blank.
If I can't sort it, suppose I'd better look to the htpasswd/htaccess files
next - but then hey!
I can't see them!
Any option/suggestions other than the obvious one of deleting the cgi-bin?
HELP!
--
millside
_____________
------------------------------
Date: 18 Jul 2001 00:23:57 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: The /e switch for regexp
Message-Id: <m1itgqd7jm.fsf@halfdome.holdit.com>
>>>>> "*" == * Tong * <* <sun_tong@users.sourceforge.net>> writes:
*> Hi,
*> I've been trying to locate the man page for the /e switch for
*> regexp, and I only find the following in perlre:
*> ,-----
*> | get into the habit of doing that, you get yourself into trouble if
*> | you then add an /e modifier.
*> |
*> | s/(\d+)/ \1 + 1 /eg; # causes warning under -w
*> `-----
*> That's the only place which covers about the /e switch, where can I
*> find more detail explanation? Thanks
It's in perlop, not necessarily as intuitive as it is historical. :)
Always check the "see also" at the bottom of the page. That's how
I found it.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
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 1323
***************************************