[22904] in Perl-Users-Digest
Perl-Users Digest, Issue: 5124 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 15 00:10:58 2003
Date: Sat, 14 Jun 2003 21:10:11 -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 Sat, 14 Jun 2003 Volume: 10 Number: 5124
Today's topics:
Re: Perl to PHP translator <no@spam.net>
Re: Perl to PHP translator <dylan@webpageworkshop.co.uk>
POE drops one state from a session <bdonlan@bd-home-comp.no-ip.org>
Re: POE drops one state from a session <ian@WINDOZEdigiserv.net>
Re: POE drops one state from a session <bdonlan@bd-home-comp.no-ip.org>
Re: POE drops one state from a session <ian@WINDOZEdigiserv.net>
Re: POE drops one state from a session <bdonlan@bd-home-comp.no-ip.org>
Reading Sendmail - mail files <ccsc3618@bigpond.net.au>
Regex question <mkipness@geniant.com>
Re: Regex question <ian@WINDOZEdigiserv.net>
Re: Regex question <bdonlan@bd-home-comp.no-ip.org>
Re: Regex question <bwalton@rochester.rr.com>
Re: Regex question (Tad McClellan)
Re: Regex question (Tad McClellan)
Re: Tad McClellan <jds@trumpetweb.co.uk>
Re: Tad McClellan (Tad McClellan)
UNstandard handling of filenames with <,> in them? <jidanni@jidanni.org>
Re: UNstandard handling of filenames with <,> in them? <ndronen@io.frii.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 14 Jun 2003 15:55:37 -0700
From: "Michael" <no@spam.net>
Subject: Re: Perl to PHP translator
Message-Id: <_JNGa.16$Ks5.36694@news.uswest.net>
Hopefully it doesn't exit.
--
- JMM
"Dean Arnold" <darnold@presicient.com> wrote in message
news:yiIGa.2725$z82.1822@newssvr19.news.prodigy.com...
> Does one exist, and if so, where can I lay hands on it?
> I've got some users interested in PHP versions of some
> of my Perl drivers (DBD::Chart, DBD::Teradata), but
> I'm clueless wrt PHP. Tried Google & SourceForge, but couldn't find
> anything.
>
> TIA
> Dean Arnold
> Presicient Corp.
> www.presicient.com
>
>
------------------------------
Date: Sat, 14 Jun 2003 23:57:41 +0100
From: Dylan Parry <dylan@webpageworkshop.co.uk>
Subject: Re: Perl to PHP translator
Message-Id: <pan.2003.06.14.22.57.41.134041@webpageworkshop.co.uk>
Michael wrote:
[Perl to PHP translator]
> Hopefully it doesn't exit.
It does. It's called me @ £50 per hour ;o)
--
Dylan Parry - http://www.DylanParry.com
------------------------------
Date: Sun, 15 Jun 2003 01:23:23 GMT
From: "bd" <bdonlan@bd-home-comp.no-ip.org>
Subject: POE drops one state from a session
Message-Id: <pan.2003.06.15.01.23.09.20493@bd-home-comp.no-ip.org>
I'm trying to write an IRC game bot, but POE's dropping the
'irc_connected' state:
---begin cmod-poe.pl---
#!/usr/bin/perl
use strict;
use diagnostics;
sub POE::Kernel::ASSERT_DEFAULT () { 1 }
use POE;
use POE::Preprocessor;
use POE::Component::IRC;
use Data::Dumper;
my $msg_vec = {
"help" => 'get_help'
};
my $pub_vec = { };
my $state_pub_vec = [
# State 1 - Idle
{
"start" => "start_game"
}
];
my $state_msg_vec = [ {} ];
my %players;
my $channel = '#ctest';
# States
const IDLE 0
;
const REG 1
;
const PLAY 2
;
const VOTE 3
;
const BUSY 4
;
my $state = IDLE;
# Conspiracy moderator (POE) v0.01
sub VERSION { 0.01; }
POE::Component::IRC->new('IRC') or die "Cannot init IRC: $!\n";
POE::Session->create
(
inline_states =>
{
_start => \&testirc_start,
irc_connected => \&testirc_connected,
irc_msg => \&testirc_msg,
irc_connected => \&testirc_connected,
get_help => \&get_help,
start_game => \&start_game,
_stop => sub { warn "_stop\n"; exit 1; }
}
);
$poe_kernel->run();
exit 0;
sub testirc_start {
my ( $heap, $kernel ) = @_[ HEAP, KERNEL ];
warn "_start";
$kernel->post('IRC', 'register', qw(connected msg));
$kernel->post('IRC', 'connect',
{
Nick => 'cmod',
Server => '(irc server)',
Port => 6667,
Username => 'precmod',
Ircname => 'Future site of CMod Conspiracy Moderator Logic Co.'
}
);
}
sub testirc_connected {
print "connected\n";
my ( $heap, $kernel ) = @_[ HEAP, KERNEL ];
$kernel->post( 'IRC', 'privmsg', 'bd_', 'hello, world!' );
$kernel->post('IRC', 'join', $channel);
}
sub testirc_msg {
my ( $heap, $kernel, $sender, $text ) = @_[ HEAP, KERNEL, ARG0, ARG2 ];
my $command = "\L$text";
$command =~ s/[^a-z].*$//;
if(exists $msg_vec->{"\L$command"}){
$kernel->yield($msg_vec->{"\L$command"}, $sender, $text);
}
if(exists $state_msg_vec->{"\L$command"}){
$kernel->yield($state_msg_vec->{"\L$command"}, $sender, $text);
}
}
sub start_game {
my ($heap, $kernel, $sender, $what) = @_[ HEAP, KERNEL, ARG0 .. $#_ ];
die unless $state == IDLE;
$state = REG;
$kernel->post('IRC', 'privmsg', $channel, 'A new game of Conspiracy has begun.');
}
---end cmod-poe.pl---
It dosen't work yet (I'm getting the IRC working before the game logic).
It gives me:
_start at ./cmod-poe.pl line 71.
connected
a 'irc_connected' state was sent from
/usr/share/perl5/POE/Component/IRC.pm at 343
to session 2, but session 2 has neither that
state nor a _default state to handle it
(I ctrl-C it here)
It dosen't send me the privmsg, or join the indicated channel, but the
print is run. What could cause this?
------------------------------
Date: Sun, 15 Jun 2003 01:39:11 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: POE drops one state from a session
Message-Id: <08jnevccahgh4lasrfs1qt8jlqfndl3mu3@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Whilst lounging around on Sun, 15 Jun 2003 01:23:23 GMT, "bd"
<bdonlan@bd-home-comp.no-ip.org> amazingly managed to produce the
following with their Etch-A-Sketch:
> I'm trying to write an IRC game bot, but POE's dropping the
> 'irc_connected' state:
bd,
Unfortunately, I can't answer your query, I had some major issues
with POE::IRC myself (although not related to your issue) when going
to convert one of my servicebots from Net::IRC. In the end, I opted
for IO::Socket and do everything RAW. I've found this not only easier
to deal with, but a hell of a lot more flexible too =)
Might be worth considering?
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPuvOPmfqtj251CDhEQJp3wCgiL+m96Nm72BvI3KXriQfXgefoLIAoJAZ
UlVwDOXMdnT/NtlNVhWD1+QD
=N9Qy
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
------------------------------
Date: Sat, 14 Jun 2003 21:49:55 -0400
From: "bd" <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: POE drops one state from a session
Message-Id: <pan.2003.06.15.01.49.54.436758@bd-home-comp.no-ip.org>
On Sun, 15 Jun 2003 01:39:11 +0000, Ian.H [dS] wrote:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> Whilst lounging around on Sun, 15 Jun 2003 01:23:23 GMT, "bd"
> <bdonlan@bd-home-comp.no-ip.org> amazingly managed to produce the
> following with their Etch-A-Sketch:
>
>> I'm trying to write an IRC game bot, but POE's dropping the
>> 'irc_connected' state:
>
>
> bd,
>
> Unfortunately, I can't answer your query, I had some major issues
> with POE::IRC myself (although not related to your issue) when going
> to convert one of my servicebots from Net::IRC. In the end, I opted
> for IO::Socket and do everything RAW. I've found this not only easier
> to deal with, but a hell of a lot more flexible too =)
>
> Might be worth considering?
I'm not that well-versed in the IRC protocol, so I'd prefer not to do that
if possible. I have a version of this program using Net::IRC which works.
This is mostly me forcing myself to learn POE, really :)
------------------------------
Date: Sun, 15 Jun 2003 02:01:43 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: POE drops one state from a session
Message-Id: <0aknevg0eb7d51qc9uc6s2jgsoafqkhlnq@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Whilst lounging around on Sat, 14 Jun 2003 21:49:55 -0400, "bd"
<bdonlan@bd-home-comp.no-ip.org> amazingly managed to produce the
following with their Etch-A-Sketch:
> > Unfortunately, I can't answer your query, I had some major issues
> > with POE::IRC myself (although not related to your issue) when
> > going to convert one of my servicebots from Net::IRC. In the end,
> > I opted for IO::Socket and do everything RAW. I've found this not
> > only easier to deal with, but a hell of a lot more flexible too
> > =)
> >
> > Might be worth considering?
>
> I'm not that well-versed in the IRC protocol, so I'd prefer not to
> do that if possible. I have a version of this program using
> Net::IRC which works. This is mostly me forcing myself to learn
> POE, really :)
Fair play bd, but just as a simple example:
if (/^:(.*) 376 .*? :End of \/MOTD command\./) {
if ($1 =~ /\.digiserv\.net/i) {
print $sock "PRIVMSG NICKSERV :IDENTIFY $bot_pwd\n";
print $sock "OPER $bot_nick $bot_pwd\n";
print $sock "PRIVMSG OPERSERV :IDENTIFY $bot_pwd\n";
print $sock "MODE $bot_nick +cny\n";
foreach (@irc_channels) {
print $sock "JOIN $_\n";
}
}
}
Tbh, it's a very long time since I read the IRC RFC, so you're
probably as wise as I am (so to speak) with it. I found that once a
connection was established, anything that was sent, was displayed
within the console window, meaning that I had everything displayed
that I needed to setup the regex as above. This goes for all others
too.
If you try somewhere like: http://irc-help.org/ you can find a list
of all numerical codes and even what's related to specific IRCds etc.
- From there, the regex for each code is pretty much identical for
everything.
My coding of this bot presently, was the first time I had looked into
sending RAW data too, so I was "blind" as such with dealing with it.
As you can see from above, the CAPS commands are pretty much what you
send as $self->(...) with Net::IRC, you just have to remember to add
the ':' before the "message", else it only takes the first
"parameter" (ie: space delimited):
print $sock "PRIVMSG ian this has spaces\n";
would send 'ian' a message, but only 'this', whereas:
print $sock "PRIVMSG ian :this has spaces\n";
sends anything after the : as a complete string.
I don't primarily code in Perl, more as a hobby, but learning from
scratch using this method, 500 lines later, and the lot probably took
me an hour to code (this includes sending the bot PRIVMSGs etc for
control etc).
If of any use to you, I can chop out the "base" of my bot and mail a
copy to you to have a look over.. whether you decide to go with that
method then or not, is entirely your choice =)
(if so, is your mail addy here accessible?)
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPuvThWfqtj251CDhEQKvIQCglBL2eKd0w8ni4+BBZQzF1VjCeH0AoIZr
rY4sQ5JmAPpAUos7SIP9dgOi
=VBsH
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
------------------------------
Date: Sat, 14 Jun 2003 22:16:17 -0400
From: "bd" <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: POE drops one state from a session
Message-Id: <pan.2003.06.15.02.16.13.735657@bd-home-comp.no-ip.org>
On Sun, 15 Jun 2003 02:01:43 +0000, Ian.H [dS] wrote:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> Whilst lounging around on Sat, 14 Jun 2003 21:49:55 -0400, "bd"
> <bdonlan@bd-home-comp.no-ip.org> amazingly managed to produce the
> following with their Etch-A-Sketch:
>
>> > Unfortunately, I can't answer your query, I had some major issues
>> > with POE::IRC myself (although not related to your issue) when
>> > going to convert one of my servicebots from Net::IRC. In the end,
>> > I opted for IO::Socket and do everything RAW. I've found this not
>> > only easier to deal with, but a hell of a lot more flexible too
>> > =)
>> >
>> > Might be worth considering?
>>
>> I'm not that well-versed in the IRC protocol, so I'd prefer not to
>> do that if possible. I have a version of this program using
>> Net::IRC which works. This is mostly me forcing myself to learn
>> POE, really :)
>
>
> Fair play bd, but just as a simple example:
[snip IRC example]
>
> I don't primarily code in Perl, more as a hobby, but learning from
> scratch using this method, 500 lines later, and the lot probably took
> me an hour to code (this includes sending the bot PRIVMSGs etc for
> control etc).
>
> If of any use to you, I can chop out the "base" of my bot and mail a
> copy to you to have a look over.. whether you decide to go with that
> method then or not, is entirely your choice =)
> (if so, is your mail addy here accessible?)
That's okay, but I'd prefer to write it on my own (that way I understand
it :) Anso, I've done some IRC over netcat, it's only parsing the result
that I never bothered to learn.
Also, the email is accessible. I should tighten the filters sometime soon,
though.
------------------------------
Date: Sun, 15 Jun 2003 03:59:40 GMT
From: "rjh" <ccsc3618@bigpond.net.au>
Subject: Reading Sendmail - mail files
Message-Id: <MaSGa.5620$GU5.87114@news-server.bigpond.net.au>
Hi, Has anyone had experience coding a perl script that can manipulate unix
mail files.
IE: The sendmail /var/spool/mail/USER mail file.
My requirement.
Logs are emailed to an account on my linux (RedHat) server.
Currently, i have to login, open mail, manually save each message out to a
file and then run perl scripts over to saved files to extract the data i
need.
Surely i can perl the mail file and read the from / date mail headers and
then save the email to file , then delete the email from
/var/spool/mail/USER.
Any modules out there that make this job easy. Any techniques / info
welcomed.
Thanks
r
------------------------------
Date: Sun, 15 Jun 2003 01:32:28 GMT
From: Max Kipness <mkipness@geniant.com>
Subject: Regex question
Message-Id: <uiinev84a2k75is8jbvjl3c134the3dvv4@4ax.com>
Hello -
I'm a bit new to Perl and am use to doing things with AWK in Bash. I'm
trying to teach myself regex and am having a hard time parsing a
simple text string. Basically I need to parse all data between a set
of brackets. I can do it with multiple parsings of the string, but I'm
trying to learn how do to things right.
$string = "some data [data in brackets] more data"
Here is what I've gotten so far, but it leaves the "more data" at the
end and I can't figure out how to get rid of it.
$parsed =~ s/(^.*\[|\]^)//g
Thanks,
Max
------------------------------
Date: Sun, 15 Jun 2003 02:34:20 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: Regex question
Message-Id: <5omnevoo13oiffsgvqouoplgcsnoee1fra@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Whilst lounging around on Sun, 15 Jun 2003 01:32:28 GMT, Max Kipness
<mkipness@geniant.com> amazingly managed to produce the following
with their Etch-A-Sketch:
> Hello -
>
> I'm a bit new to Perl and am use to doing things with AWK in Bash.
> I'm trying to teach myself regex and am having a hard time parsing
> a
> simple text string. Basically I need to parse all data between a
> set of brackets. I can do it with multiple parsings of the string,
> but I'm trying to learn how do to things right.
>
> $string = "some data [data in brackets] more data"
>
> Here is what I've gotten so far, but it leaves the "more data" at
> the end and I can't figure out how to get rid of it.
>
> $parsed =~ s/(^.*\[|\]^)//g
>
> Thanks,
> Max
Message-ID: <6njnev8johh0716q02c756l2466ala98io@4ax.com>
$multiposting != $good ;)
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPuvbKmfqtj251CDhEQJdCgCdE/52/gTGwX8ZN3sbd1QIpo10imsAoODy
1AZfHYdwpqSI6VvEL1kXBX2R
=O2kA
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
------------------------------
Date: Sat, 14 Jun 2003 22:41:56 -0400
From: "bd" <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: Regex question
Message-Id: <pan.2003.06.15.02.41.53.95259@bd-home-comp.no-ip.org>
On Sun, 15 Jun 2003 01:32:28 +0000, Max Kipness wrote:
> Hello -
>
> I'm a bit new to Perl and am use to doing things with AWK in Bash. I'm
> trying to teach myself regex and am having a hard time parsing a
> simple text string. Basically I need to parse all data between a set
> of brackets. I can do it with multiple parsings of the string, but I'm
> trying to learn how do to things right.
>
> $string = "some data [data in brackets] more data"
>
> Here is what I've gotten so far, but it leaves the "more data" at the
> end and I can't figure out how to get rid of it.
>
> $parsed =~ s/(^.*\[|\]^)//g
Try this:
$parsed =~ s/^[^[]*\[([^]]*)].*$/\1/;
------------------------------
Date: Sun, 15 Jun 2003 03:01:02 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Regex question
Message-Id: <3EEBE16D.5030506@rochester.rr.com>
Max Kipness wrote:
> Hello -
>
> I'm a bit new to Perl and am use to doing things with AWK in Bash. I'm
> trying to teach myself regex and am having a hard time parsing a
> simple text string. Basically I need to parse all data between a set
> of brackets. I can do it with multiple parsings of the string, but I'm
> trying to learn how do to things right.
>
> $string = "some data [data in brackets] more data"
>
> Here is what I've gotten so far, but it leaves the "more data" at the
> end and I can't figure out how to get rid of it.
>
> $parsed =~ s/(^.*\[|\]^)//g
>
> Thanks,
> Max
>
I'm not sure exactly what you mean by "parse all data between a set of
brackets". If you mean you want to extract the text between the first
pair of brackets in a string, try something like:
$string = "some data [data in brackets] more data";
($parsed) = $string =~ /\[([^]]*)\]/;
print "parsed:$parsed\n";
--
Bob Walton
------------------------------
Date: Sat, 14 Jun 2003 22:01:32 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Regex question
Message-Id: <slrnbenocc.9n2.tadmc@magna.augustmail.com>
bd <bdonlan@bd-home-comp.no-ip.org> wrote:
> On Sun, 15 Jun 2003 01:32:28 +0000, Max Kipness wrote:
>> I need to parse all data between a set
>> of brackets.
> Try this:
> $parsed =~ s/^[^[]*\[([^]]*)].*$/\1/;
Then enable warnings, and use $1 instead of \1 when not in a regex. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 14 Jun 2003 22:09:34 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Regex question
Message-Id: <slrnbenore.9n2.tadmc@magna.augustmail.com>
Max Kipness <mkipness@geniant.com> wrote:
> Basically I need to parse all data between a set
> of brackets.
> $string = "some data [data in brackets] more data"
>
> Here is what I've gotten so far, but it leaves the "more data" at the
> end and I can't figure out how to get rid of it.
>
> $parsed =~ s/(^.*\[|\]^)//g
What is in the string that the regex is to attempt to match
against ($parsed)?
Did you mean to match against $string instead?
my($parsed) = $string =~ / \[
( [^]]+ ) # capture contents
]
/x;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 14 Jun 2003 21:03:39 +0100
From: "Julia deSilva" <jds@trumpetweb.co.uk>
Subject: Re: Tad McClellan
Message-Id: <sbLGa.494$zS5.153@news-binary.blueyonder.co.uk>
I think many of you have gotten the wrong end of the stick from what I said.
Tadd Dameron was a Jazz great.
I often scan down the listings in the NG for Tad's offerings because they
are almost always useful, funny and correct.
------------------------------
Date: Sat, 14 Jun 2003 16:53:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Tad McClellan
Message-Id: <slrnben6b1.8l3.tadmc@magna.augustmail.com>
Julia deSilva <jds@trumpetweb.co.uk> wrote:
> firing thunderbolts
> down to earth every-so-often
There are some who call me ...
...
... Tim?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 15 Jun 2003 06:28:33 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: UNstandard handling of filenames with <,> in them?
Message-Id: <878ys4nvji.fsf@jidanni.org>
Hurmf, I see, perl is giving me extra value in reinterpreting my file
names or something.
# ls
<871xy8xlgk.fsf@jidanni.org> <87fzmsj1zq.fsf@jidanni.org> <87ptltcrwh.fsf@jidanni.org>...
# awk NR==1 *
Newsgroups: gmane.network.noffle.user
# perl -nwe 'if ($.==1){print}' *
Can't open <87el1wo0j9.fsf@jidanni.org>: No such file or directory.
Can't open <87fzmpcdyw.fsf@jidanni.org>: No such file or directory....
# ls|sed 's/[<>]/\\&/g'|xargs perl -nwe 'if($.==1){print}' #same deal
Wait, never mind. It needs a "./".
# find . -type f|xargs perl -nwe 'if($.==1){print} #works finally
Anyway, who's being unstandard here, awk or perl?
Here are some other commands that don't have problems:
# ls|xargs ls; ls *; cat *|wc -l; sed p *|wc -l; wc -l *
--
http://jidanni.org/ Taiwan(04)25854780
------------------------------
Date: 15 Jun 2003 01:41:51 GMT
From: Nicholas Dronen <ndronen@io.frii.com>
Subject: Re: UNstandard handling of filenames with <,> in them?
Message-Id: <3eebcedf$0$202$75868355@news.frii.net>
Dan Jacobson <jidanni@jidanni.org> wrote:
DJ> Hurmf, I see, perl is giving me extra value in reinterpreting my file
DJ> names or something.
DJ> # ls
DJ> <871xy8xlgk.fsf@jidanni.org> <87fzmsj1zq.fsf@jidanni.org> <87ptltcrwh.fsf@jidanni.org>...
DJ> # awk NR==1 *
DJ> Newsgroups: gmane.network.noffle.user
DJ> # perl -nwe 'if ($.==1){print}' *
DJ> Can't open <87el1wo0j9.fsf@jidanni.org>: No such file or directory.
DJ> Can't open <87fzmpcdyw.fsf@jidanni.org>: No such file or directory....
DJ> # ls|sed 's/[<>]/\\&/g'|xargs perl -nwe 'if($.==1){print}' #same deal
DJ> Wait, never mind. It needs a "./".
DJ> # find . -type f|xargs perl -nwe 'if($.==1){print} #works finally
DJ> Anyway, who's being unstandard here, awk or perl?
DJ> Here are some other commands that don't have problems:
DJ> # ls|xargs ls; ls *; cat *|wc -l; sed p *|wc -l; wc -l *
Perl's open sees the '<' as an open directive, so that character gets lost.
$ ls; strace -o open.out -e trace=open perl -wpe '' * 2>/dev/null; cat open.out
<871xy8xlgk.fsf@jidanni.org> <87fzmsj1zq.fsf@jidanni.org> <87ptltcrwh.fsf@jidanni.org>
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
open("/lib/libdl.so.2", O_RDONLY) = 3
open("/lib/libm.so.6", O_RDONLY) = 3
open("/lib/libc.so.6", O_RDONLY) = 3
open("/lib/libcrypt.so.1", O_RDONLY) = 3
open("/dev/null", O_RDONLY|O_LARGEFILE) = 3
open("871xy8xlgk.fsf@jidanni.org>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such . . .
open("87fzmsj1zq.fsf@jidanni.org>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such . . .
open("87ptltcrwh.fsf@jidanni.org>", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such . . .
Regards,
Nicholas
--
"Why shouldn't I top-post?" http://www.aglami.com/tpfaq.html
"Meanings are another story." http://www.ifas.org/wa/glossolalia.html
------------------------------
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 5124
***************************************