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
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
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
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,
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
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
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
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
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
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
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
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
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
...)
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
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
={}), 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/
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
(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/
;
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
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
... 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
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
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
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
24 matches
Mail list logo