Re: what's the error?

2011-11-04 Thread Anneli Cuss
I think it mimics (or is?) the system's errno. See: http://linux.die.net/man/3/errno > Its value is significant only when the return value of the call indicated an error (i.e., -1 from most system calls; -1 or NULL from most library functions); a function that succeeds is allowed to change errno.

Re: what's the error?

2011-11-04 Thread David Christensen
On 11/04/2011 07:48 PM, Ken Peng wrote: perl -le 'open HD,"/etc/passwd" or die $!; ; print $!' Here's your one-liner as a script with some "printf" instrumentation: $ nl HD.pl 1 #!/usr/bin/perl 2 use strict; 3 use warnings; 4 open HD,"/etc/passwd" or die $!; 5 pri

Re: what's the error?

2011-11-04 Thread Ken Peng
于 2011-11-5 11:16, Anneli Cuss 写道: $! is not guaranteed to be cleared if there was no error. This means you probably don't have a "Bad file descriptor" error, it's just the last value of $! (or 'errno'). That's confused. Since there is not such an error, I was thinking $! or $@ shouldn't inclu

Re: what's the error?

2011-11-04 Thread Anneli Cuss
$! is not guaranteed to be cleared if there was no error. This means you probably don't have a "Bad file descriptor" error, it's just the last value of $! (or 'errno'). See perlvar: http://perldoc.perl.org/perlvar.html#Variables-related-to-filehandles For example, let's try $! when I haven't run a

what's the error?

2011-11-04 Thread Ken Peng
Hi, $ perl -le 'open HD,"/etc/passwd" or die $!; ; print $!' Bad file descriptor what does this error mean? why it happens? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: regex

2011-11-04 Thread Chris Stinemetz
Sorry for the duplicate Jim. I meant to reply all on the original. On Fri, Nov 4, 2011 at 3:33 PM, Chris Stinemetz wrote: > > > >> I don't think I could improve on the extended regex with comments posted >> by >> Shawn H. Corey. His regex is the same as mine, with the addition of a >> couple >> o

Re: regex

2011-11-04 Thread Jim Gibson
On 11/4/11 Fri Nov 4, 2011 12:56 PM, "Chris Stinemetz" scribbled: >> >> >> >> Try this: >> >> "Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH" =~ /Cell\s*(\d+)\s*(.*),\s*HEH/; >> print "<$1> <$2>\n"; >> >> > > > Thank you Jim. This did the trick! Do you mind explaining how you did this? > I'm try

Re: regex

2011-11-04 Thread Uri Guttman
On 11/04/2011 03:56 PM, Chris Stinemetz wrote: Try this: "Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH" =~ /Cell\s*(\d+)\s*(.*),\s*HEH/; print "<$1> <$2>\n"; Thank you Jim. This did the trick! Do you mind explaining how you did this? I'm trying to make sense of it with my perl regex cheat sheet

Re: regex

2011-11-04 Thread Brandon McCaig
On Fri, Nov 04, 2011 at 02:56:35PM -0500, Chris Stinemetz wrote: > Thank you Jim. This did the trick! Do you mind explaining how you did this? > I'm trying to make sense of it with my perl regex cheat sheet I found > online. Execute the following commands to read the docs: perldoc perlre perldoc

Re: regex

2011-11-04 Thread Chris Stinemetz
> > > > Try this: > > "Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH" =~ /Cell\s*(\d+)\s*(.*),\s*HEH/; > print "<$1> <$2>\n"; > > Thank you Jim. This did the trick! Do you mind explaining how you did this? I'm trying to make sense of it with my perl regex cheat sheet I found online. http://www.erudil.com

Re: regex

2011-11-04 Thread Shawn H Corey
On 11-11-04 01:42 PM, Chris Stinemetz wrote: I am trying to match a line that has HEH in it. I would also like to store the number follow CELL in memory variable $1 and store everything following the number and upto excluding ", HEH" in memory variable $2 so this line: Cell 999 CDM 1, 2, CBR 1

Re: regex

2011-11-04 Thread Sheppy R
This should do it - m/Cell (\d+)(.*), HEH/ On Fri, Nov 4, 2011 at 1:42 PM, Chris Stinemetz wrote: > I am trying to match a line that has HEH in it. > > I would also like to store the number follow CELL in memory variable $1 > and store everything following the number and upto excluding ", HEH"

Re: regex

2011-11-04 Thread Jim Gibson
On 11/4/11 Fri Nov 4, 2011 10:42 AM, "Chris Stinemetz" scribbled: > I am trying to match a line that has HEH in it. > > I would also like to store the number follow CELL in memory variable $1 > and store everything following the number and upto excluding ", HEH" in > memory variable $2 > > so

regex

2011-11-04 Thread Chris Stinemetz
I am trying to match a line that has HEH in it. I would also like to store the number follow CELL in memory variable $1 and store everything following the number and upto excluding ", HEH" in memory variable $2 so this line: Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH will equal: $1 = 999 $2 = CDM 1,

Re: timings of perl subroutine with a program

2011-11-04 Thread Shlomi Fish
Hi "a b", On Fri, 4 Nov 2011 15:18:00 +0530 a b wrote: > apologize!! > > Can you help me to understand how async I/O can help me > What's wrong with the resources in the URL I pointed you to? There's also http://en.wikipedia.org/wiki/Asynchronous_I/O which may be of interest. "The Gods help

Re: timings of perl subroutine with a program

2011-11-04 Thread a b
apologize!! Can you help me to understand how async I/O can help me Regards a b On Thu, Nov 3, 2011 at 9:06 PM, Shlomi Fish wrote: > Hello a b, > > please reply to the list as I specifically request in my signature. > (Wretched > gmail.com.) I'm CCing the list. > > On Thu, 3 Nov 2011 16:15:11