given-when statement as a rvalue?

2010-12-26 Thread Peter Daum
Is it possible to get a value from a given-when statement? Suppose I have a long comparison in which all branches affect the same variable. Here's a short example (minor variation fromperlsyn): given($something) { when (/^abc/) { $x = 1; } when (/^def/) { $x = 2; } when (/^xyz/) { $x

Re: given-when statement as a rvalue?

2010-12-26 Thread Peter Daum
On 2010-12-26 18:28, Brian Fraser wrote: Your example actually works -- On perl 5.13.+: http://www.effectiveperlprogramming.com/blog/683 that's good news (even though it means I'll have to wait a little longer until I can actually use it) - at least I'm obviously not the only one who felt, that

Re: perl in Makefile

2010-05-14 Thread Peter Daum
On 2010-05-13 19:00, Patrick Dupre wrote: How can I execute the following command in a Makefile ? CORE_INC=`perl -MConfig -MFile::Spec::Functions -le 'print catfile($Config{archlib},CORE)')` The problem is with the $Config ! CORE_INC=`perl -MConfig -MFile::Spec::Functions -le 'print

UTF-8 and Internal Representation of (Latin1) Characters

2010-05-11 Thread Peter Daum
Because I had little need for it I had tried to just ignore Perl's Unicode support as long as possible. Now it looks like I can't do that anymore, so I started looking through the various docs. One thing that confused me: several sources mention Perl using 8-bit characters as long as possible,

quoting meta chars in regex containing variables

2009-08-29 Thread Peter Daum
I'm struggling with a tricky quoting problem: I need to split lines divided by some delimiter; - The delimiter usually will be '|', but can be changed, so it needs to be variable. - Furthermore, the columns may also contain the delimiter, in which case it is quoted by a backslash No

Re: quoting meta chars in regex containing variables

2009-08-29 Thread Peter Daum
Chas. Owens wrote: On Sat, Aug 29, 2009 at 11:44, Peter Daumgator...@yahoo.de wrote: I'm struggling with a tricky quoting problem: I need to split lines divided by some delimiter; - The delimiter usually will be '|', but can be changed, so it needs to be variable. - Furthermore, the columns

Re: while () and wildcards on DOS/Windows

2009-08-10 Thread Peter Daum
John W. Krahn wrote: Peter Daum wrote: Unfortunately, this leads right to the next problem: I also need binmode to turn off cr/lf conversion on DOS; with while () I don't know where to do this anymore, because AFAIK, this has to be done after open, but before the 1st I/O; now before the while

while () and wildcards on DOS/Windows

2009-08-03 Thread Peter Daum
Hi, I occasionally have to write Perl scripts that should behave the same on Unix- and DOS-like Systems. One little problem I encounter there is: For quick hacks, the while() mechanism is very handy, because it saves a lot of typing. On Unix, I can call a script as a filter, with filenames or

Re: while () and wildcards on DOS/Windows

2009-08-03 Thread Peter Daum
Shawn H. Corey wrote: I've always used: beg...@argv=glob(@ARGV)} ... I still need at least: BEGIN{ @ARGV=map { glob($_) } @ARGV } but that's already much shorter - thanks :-) Unfortunately, this leads right to the next problem: I also need binmode to turn off cr/lf conversion on DOS; with

Re: while () and wildcards on DOS/Windows

2009-08-03 Thread Peter Daum
Ed Avis wrote: Peter Daum gator_ml at yahoo.de writes: With more recent Perl versions, when a script is called with '*.xyz' it will just try to open '*.xyz' and fail. What version of Perl do you have? (perl -V) ... when I 1st encountered this problem, it was with ActivePerl 5.8

Re: while () and wildcards on DOS/Windows

2009-08-03 Thread Peter Daum
Shawn H. Corey wrote: Peter Daum wrote: Unfortunately, this leads right to the next problem: I also need binmode to turn off cr/lf conversion on DOS; with while () I don't know where to do this anymore, because AFAIK, this has to be done after open, but before the 1st I/O; now before

Perl IO::Socket::INET vs. netcat

2009-03-02 Thread Peter Daum
of (buffer sizes, autoflush, syswrite instead of print, delays ...) but so far I couldn't find anything that makes a difference. Does anybody have an idea? Any hints are welcome! Regards, Peter Daum -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e

Retrieving Bit-Field/Hex-String with Perl/Net-SNMP

2009-01-05 Thread Peter Daum
Hi, I am trying to retrieve a bit vector containing the error status of a printer with the Net-SNMP module. With the command line snmpget program, this works: # snmpget -v1 -cpublic printer .1.3.6.1.2.1.25.3.5.1.2.1 HOST-RESOURCES-MIB::hrPrinterDetectedErrorState.1 = Hex-STRING: 00 With the

Re: Retrieving Bit-Field/Hex-String with Perl/Net-SNMP

2009-01-05 Thread Peter Daum
...) With Net::SNMP, it works to retrieve the value in question, but it has some other issues, so I am trying to get SNMP to work ... Peter Rob Dixon wrote: Peter Daum wrote: I am trying to retrieve a bit vector containing the error status of a printer with the Net-SNMP

Re: after upgrade: glibc detected *** /usr/bin/perl: double free or corruption

2008-10-03 Thread Peter Daum
Peter Daum wrote: I recently upgraded a system (as far as perl is concerned from 5.8.8 to 5.10.0). Afterwards I ran into a mysterious problem. I could eventually find a workaround, but still don't really understand, what is going on. After the upgrade, a perl program wouldn't run anymore

after upgrade: glibc detected *** /usr/bin/perl: double free or corruption

2008-10-01 Thread Peter Daum
={}), the code also works without any problem. Regards, Peter Daum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: after upgrade: glibc detected *** /usr/bin/perl: double free or corruption

2008-10-01 Thread Peter Daum
Peter Daum wrote: - Where does glib come into play? Is it generally used by perl? Oops - I just noticed that it doesn't say glib but glibc (and am not particulary surprised about perl using the c library ;-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

Strange interaction of my-variables with initialization

2008-01-13 Thread Peter Daum
(tm)? If it is a feature, then why isn't the value also retained in the 1st example? Regards, Peter Daum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Interpolation of backslash-escapes

2006-11-03 Thread Peter Daum
; but somehow i couldn't get it right ... Can anybody think of an elegant solution? Regards, Peter Daum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Non-blocking write to FIFO

2006-10-23 Thread Peter Daum
is available, but I can't think of any way to get such a signal if the pipe is opened for reading (so I could afterwards open it for writing). Ainy ideas? Regards, Peter Daum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http

Re: Non-blocking write to FIFO

2006-10-23 Thread Peter Daum
... in the meantime, I discovered a solution, so let me answer my own question in case somebody else stumbles on this. Peter Daum wrote: I am trying to figure out a way to write data to a fifo without knowing whether there is a reader available and without ever blocking. What I'd like

POD: force line break?

2006-08-06 Thread Peter Daum
Hi, Is there any way, to force a line break in POD, without starting a new paragraph? Regards, Peter Daum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: POD: force line break?

2006-08-06 Thread Peter Daum
any formatting. I'm afraid, the E10 is about close as it gets... Thanks a lot, Peter Daum -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: strange regex problem with backslash and newline

2006-08-05 Thread Peter Daum
Tom Phoenix wrote: On 8/5/06, Peter Daum [EMAIL PROTECTED] wrote: $s =~ /^(.*[^\\])(\\)?$/; print 1: '$1', 2: '$2'; Let's see what that pattern matches by annotating it: m{ ^ # start of string ( # memory 1 .*# any ol' junk, including backslashes