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, tha

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 from"perlsyn"): given($something) { when (/^abc/) { $x = 1; } when (/^def/) { $x = 2; } when (/^xyz/) { $

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 'prin

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, whi

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 Daum 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 m

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 problem

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 bef

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

Re: while (<>) and wildcards on DOS/Windows

2009-08-03 Thread Peter Daum
Ed Avis wrote: Peter Daum 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 ActivePe

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; wit

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 o

Perl IO::Socket::INET vs. netcat

2009-03-02 Thread Peter Daum
t variations I could think 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..

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

2009-01-05 Thread Peter Daum
se lots of confusion ...) 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 th

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 Ne

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'

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 ad

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

2008-10-01 Thread Peter Daum
P. However, when $self is just some hash reverence ("my $self={}"), 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/

Strange interaction of "my"-variables with initialization

2008-01-13 Thread Peter Daum
$t now retains its value from the last loop iteration. Is this a bug or a feature (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
polation) or $s=~ s/\\(.)/"\\$1"/eg; 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>

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&

Non-blocking write to FIFO

2006-10-23 Thread Peter Daum
ossible to ge a signal if data 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 comman

Re: POD: force line break?

2006-08-06 Thread Peter Daum
and the output format. Using verbatim paragraphs would mean doing without any formatting. I'm afraid, the E<10> 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>

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: 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 stri

strange regex problem with backslash and newline

2006-08-05 Thread Peter Daum
he end. When I do a chomp($s) first, everything behaves as expected, while a "/m" at the end of the regular expression doesn't make any difference. Does anybody have an explanation what is going on here? Regards, Peter Daum -- To unsubscribe, e-mail: [EMAI