[31118] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2363 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 23 21:09:48 2009

Date: Thu, 23 Apr 2009 18:09:14 -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           Thu, 23 Apr 2009     Volume: 11 Number: 2363

Today's topics:
        Can I use True and False like this in Perl ? <someone@somewhere.nb.ca>
    Re: Can I use True and False like this in Perl ? sln@netherlands.com
    Re: Can I use True and False like this in Perl ? (Randal L. Schwartz)
    Re: Can I use True and False like this in Perl ? <someone@somewhere.nb.ca>
    Re: Can I use True and False like this in Perl ? sln@netherlands.com
    Re: Can I use True and False like this in Perl ? sln@netherlands.com
    Re: Can I use True and False like this in Perl ? <jurgenex@hotmail.com>
    Re: Can I use True and False like this in Perl ? <noreply@gunnar.cc>
    Re: Can I use True and False like this in Perl ? (Randal L. Schwartz)
    Re: Can I use True and False like this in Perl ? sln@netherlands.com
    Re: Can I use True and False like this in Perl ? sln@netherlands.com
    Re: Can I use True and False like this in Perl ? sln@netherlands.com
    Re: Encode::decode() clears scalar being decoded? <smallpond@juno.com>
    Re: Encode::decode() clears scalar being decoded? sln@netherlands.com
    Re: Encode::decode() clears scalar being decoded? <peter@makholm.net>
    Re: Encode::decode() clears scalar being decoded? sln@netherlands.com
    Re: Encode::decode() clears scalar being decoded? sln@netherlands.com
    Re: Exiting given via next sln@netherlands.com
    Re: Exiting given via next sln@netherlands.com
    Re: Is there a better way to convert foreign characters <someone@somewhere.nb.ca>
    Re: Is there a module to transliterate Russian and Ukra <news123@free.fr>
    Re: Is there a module to transliterate Russian and Ukra <news123@free.fr>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 23 Apr 2009 19:01:52 -0300
From: "Guy" <someone@somewhere.nb.ca>
Subject: Can I use True and False like this in Perl ?
Message-Id: <49f0e53d$0$5463$9a566e8b@news.aliant.net>

Instead of having the following throughout my script:

    if ($adm = $password) { &DoThisAndThat; }

I think I'd rather have this at the beginning:

    if ($adm = $password) {$adm = True;}

And then have the following throughout my script:

    if ($adm) { &DoThisAndThat; }

Can I store (True) in a scalar, and use it like this?

Guy




------------------------------

Date: Thu, 23 Apr 2009 15:04:49 -0700
From: sln@netherlands.com
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <oep1v49f44qkvja4u6655d7fgnplehn9vj@4ax.com>

On Thu, 23 Apr 2009 19:01:52 -0300, "Guy" <someone@somewhere.nb.ca> wrote:

>Instead of having the following throughout my script:
>
>    if ($adm = $password) { &DoThisAndThat; }
>
>I think I'd rather have this at the beginning:
>
>    if ($adm = $password) {$adm = True;}
>
>And then have the following throughout my script:
>
>    if ($adm) { &DoThisAndThat; }
>
>Can I store (True) in a scalar, and use it like this?
>
>Guy
>
use constant True => 1;

-sln


------------------------------

Date: Thu, 23 Apr 2009 15:18:53 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <86bpqnau9e.fsf@blue.stonehenge.com>

>>>>> "Guy" == Guy  <someone@somewhere.nb.ca> writes:

Guy> Instead of having the following throughout my script:
Guy>     if ($adm = $password) { &DoThisAndThat; }

I think you want eithr == (for numeric equal) or "eq" (for string equal).

Guy> I think I'd rather have this at the beginning:

Guy>     if ($adm = $password) {$adm = True;}

I think you just want this:

  $adm = $adm eq $password;

Guy> And then have the following throughout my script:

Guy>     if ($adm) { &DoThisAndThat; }

Guy> Can I store (True) in a scalar, and use it like this?

Guy> Guy

And yes, that'll then work.

print "Just another Perl hacker,"; # the original

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Thu, 23 Apr 2009 19:37:38 -0300
From: "Guy" <someone@somewhere.nb.ca>
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <49f0ed9f$0$5475$9a566e8b@news.aliant.net>


"Randal L. Schwartz" <merlyn@stonehenge.com> a écrit dans le message de 
news: 86bpqnau9e.fsf@blue.stonehenge.com...
>>>>>> "Guy" == Guy  <someone@somewhere.nb.ca> writes:
>
> Guy> Instead of having the following throughout my script:
> Guy>     if ($adm = $password) { &DoThisAndThat; }
>
> I think you want eithr == (for numeric equal) or "eq" (for string equal).

Yes I'm sorry about that, I was not pasting code I just typing it on the fly 
and I have to admit I'm not used to the double equal.

>
> Guy> I think I'd rather have this at the beginning:
>
> Guy>     if ($adm = $password) {$adm = True;}
>
> I think you just want this:
>
>  $adm = $adm eq $password;
>

Oh God I'm sorry, I meant eq.
Yes that looks good, so I assume that $adm will be true if $adm eq 
$password.

> Guy> And then have the following throughout my script:
>
> Guy>     if ($adm) { &DoThisAndThat; }
>
> Guy> Can I store (True) in a scalar, and use it like this?
>
> Guy> Guy
>
> And yes, that'll then work.

I'll give it a try. thanks
Guy

>
> print "Just another Perl hacker,"; # the original
>
> -- 
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
> 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside 
> discussion 




------------------------------

Date: Thu, 23 Apr 2009 15:37:29 -0700
From: sln@netherlands.com
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <6cr1v4hdrm535j42q15karktc0rvvepm6l@4ax.com>

On Thu, 23 Apr 2009 15:18:53 -0700, merlyn@stonehenge.com (Randal L. Schwartz) wrote:

>>>>>> "Guy" == Guy  <someone@somewhere.nb.ca> writes:
>
>Guy> Instead of having the following throughout my script:
>Guy>     if ($adm = $password) { &DoThisAndThat; }
>
>I think you want eithr == (for numeric equal) or "eq" (for string equal).
>
>Guy> I think I'd rather have this at the beginning:
>
>Guy>     if ($adm = $password) {$adm = True;}
>
>I think you just want this:
>
>  $adm = $adm eq $password;
>
>Guy> And then have the following throughout my script:
>
>Guy>     if ($adm) { &DoThisAndThat; }
>
>Guy> Can I store (True) in a scalar, and use it like this?
>
>Guy> Guy
>
>And yes, that'll then work.
>
>print "Just another Perl hacker,"; # the original

Nice tutorial. Slow day?
-sln


------------------------------

Date: Thu, 23 Apr 2009 15:40:34 -0700
From: sln@netherlands.com
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <0gr1v41q2b1h5oegsek1d2nmj804uhfq2j@4ax.com>

On Thu, 23 Apr 2009 19:37:38 -0300, "Guy" <someone@somewhere.nb.ca> wrote:

>
>"Randal L. Schwartz" <merlyn@stonehenge.com> a écrit dans le message de 
>news: 86bpqnau9e.fsf@blue.stonehenge.com...
>>>>>>> "Guy" == Guy  <someone@somewhere.nb.ca> writes:
>>
>> Guy> Instead of having the following throughout my script:
>> Guy>     if ($adm = $password) { &DoThisAndThat; }
>>
>> I think you want eithr == (for numeric equal) or "eq" (for string equal).
>
>Yes I'm sorry about that, I was not pasting code I just typing it on the fly 
>and I have to admit I'm not used to the double equal.
>
Neither am I. Isn't one '=' enough, why have more is what I say.
-sln


------------------------------

Date: Thu, 23 Apr 2009 15:59:12 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <4ds1v49ssfv5jaerpls9ibf2abhrcuva7f@4ax.com>

"Guy" <someone@somewhere.nb.ca> wrote:
>Instead of having the following throughout my script:
>    if ($adm = $password) { &DoThisAndThat; }

Are you certain that your passwords are numerical? That is rather
uncommon.

Why are you using the &-from of calling subroutines? Are you aware what
that form is doing?

>I think I'd rather have this at the beginning:
>    if ($adm = $password) {$adm = True;}

Why not 
	$adm = ($adm eq $password); #paranthesis only for clarification

>And then have the following throughout my script:
>
>    if ($adm) { &DoThisAndThat; }
>
>Can I store (True) in a scalar, and use it like this?

Yes, but it will do something quite different than you probably think it
is doing.
Any, yes any Perl scalar has a boolean values, e.g. any non-empty string
evaluates as boolean true. 

jue


------------------------------

Date: Fri, 24 Apr 2009 01:31:57 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <75cc3pF17ecnrU1@mid.individual.net>

Jürgen Exner wrote:
> ... any non-empty string evaluates as boolean true.

$ perl -le '
$_ = "0";
print length;
print $_ ? "True" : "False";
'
1
False
$

;-)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Thu, 23 Apr 2009 16:42:47 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <86y6tr9bt4.fsf@blue.stonehenge.com>

>>>>> "sln" == sln  <sln@netherlands.com> writes:

>> Yes I'm sorry about that, I was not pasting code I just typing it on the fly 
>> and I have to admit I'm not used to the double equal.
>> 
sln> Neither am I. Isn't one '=' enough, why have more is what I say.

Because two works, and one doesn't?  That's what I say. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Thu, 23 Apr 2009 16:48:58 -0700
From: sln@netherlands.com
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <bgv1v4lnlolfja9bf0bj19f9rhb8ms55r4@4ax.com>

On Thu, 23 Apr 2009 16:42:47 -0700, merlyn@stonehenge.com (Randal L. Schwartz) wrote:

>>>>>> "sln" == sln  <sln@netherlands.com> writes:
>
>>> Yes I'm sorry about that, I was not pasting code I just typing it on the fly 
>>> and I have to admit I'm not used to the double equal.
>>> 
>sln> Neither am I. Isn't one '=' enough, why have more is what I say.
>
>Because two works, and one doesn't?  That's what I say. :)
Hey, each to his own idiom(acy).
Thats what I say.
-sln


------------------------------

Date: Thu, 23 Apr 2009 17:05:07 -0700
From: sln@netherlands.com
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <og02v45dq50oslfivtr7jaurt4pevmb7ta@4ax.com>

On Fri, 24 Apr 2009 01:31:57 +0200, Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:

>Jürgen Exner wrote:
>> ... any non-empty string evaluates as boolean true.
>
>$ perl -le '
>$_ = "0";
>print length;
>print $_ ? "True" : "False";
>'
>1
>False
>$
>
>;-)

Tweedle de and tweedle dum
-sln


------------------------------

Date: Thu, 23 Apr 2009 17:40:28 -0700
From: sln@netherlands.com
Subject: Re: Can I use True and False like this in Perl ?
Message-Id: <ah22v45dq50oslfivtr7jaurt4pevmb7ko@4ax.com>

On Thu, 23 Apr 2009 15:04:49 -0700, sln@netherlands.com wrote:

>On Thu, 23 Apr 2009 19:01:52 -0300, "Guy" <someone@somewhere.nb.ca> wrote:
>
>>Instead of having the following throughout my script:
>>
>>    if ($adm = $password) { &DoThisAndThat; }
>>
>>I think I'd rather have this at the beginning:
>>
>>    if ($adm = $password) {$adm = True;}
>>
>>And then have the following throughout my script:
>>
>>    if ($adm) { &DoThisAndThat; }
>>
>>Can I store (True) in a scalar, and use it like this?
>>
>>Guy
>>
>use constant True => 1;
>
>-sln

Hey, I believe this was the real question.....
Wasn't it ??????????????????????

No schmucks need reply

-sln


------------------------------

Date: Thu, 23 Apr 2009 14:27:59 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: Encode::decode() clears scalar being decoded?
Message-Id: <2414d64e-4de2-4f48-b601-5b600e752f85@g1g2000yqh.googlegroups.com>

On Apr 23, 3:41 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2009-04-23 00:08, Robert Urban <ur...@tru64.org> wrote:
>
> > my $tmp = decode('utf8', $string, 1);
>
> [sets $string to ""]
>
> > What happened to $string?  There is no mention of side-effects in the Encode
> > manpage...
>
> There is, but only for CHECK == FB_QUIET or FB_WARN, not for FB_CROAK
> (1).
>
> > This only happens when CHECK is set to 1.
>
> Nope, it also happens if CHECK is set to 4 (FB_QUIET) or 6 (FB_WARN).
> But there it is documented.
>
> I'm not sure if this is a bug or an (undocumented) feature.
>
>         hp

According to the source code if check is non-zero it always
overwrites the input string UNLESS check has LEAVE_SRC set.
The documentation implies that check is only used when there
is a bad character in the input, but this is not true.


------------------------------

Date: Thu, 23 Apr 2009 15:01:31 -0700
From: sln@netherlands.com
Subject: Re: Encode::decode() clears scalar being decoded?
Message-Id: <t7p1v4hi822l73dg7uae2o3rkre6lo38i8@4ax.com>

On Thu, 23 Apr 2009 21:41:55 +0200, "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:

>On 2009-04-23 00:08, Robert Urban <urban@tru64.org> wrote:
>> my $tmp = decode('utf8', $string, 1);
>
>[sets $string to ""]
>
>> What happened to $string?  There is no mention of side-effects in the Encode
>> manpage...
>
>There is, but only for CHECK == FB_QUIET or FB_WARN, not for FB_CROAK
>(1). 
>
>> This only happens when CHECK is set to 1.
>
>Nope, it also happens if CHECK is set to 4 (FB_QUIET) or 6 (FB_WARN).
>But there it is documented.
>
>I'm not sure if this is a bug or an (undocumented) feature.
>
>	hp
All programmers know its a feature, there are no bugs!

-sln


------------------------------

Date: Thu, 23 Apr 2009 08:46:57 +0200
From: Peter Makholm <peter@makholm.net>
Subject: Re: Encode::decode() clears scalar being decoded?
Message-Id: <87zle7amu6.fsf@vps1.hacking.dk>

Robert Urban <urban@tru64.org> writes:

> What happened to $string?  There is no mention of side-effects in the Encode
> manpage... This only happens when CHECK is set to 1.

The Encoding complex of API's is at best confusing and at worst right
out misleading. What you see fits with the documentation of the decode
method of Encode::Encoding and I have never found the piece of code
that are supposed to convert between the two API's.

//Makholm


------------------------------

Date: Thu, 23 Apr 2009 17:57:02 -0700
From: sln@netherlands.com
Subject: Re: Encode::decode() clears scalar being decoded?
Message-Id: <co22v4pje9dtdktv0trc6444qton0rd330@4ax.com>

On Thu, 23 Apr 2009 15:01:31 -0700, sln@netherlands.com wrote:

>On Thu, 23 Apr 2009 21:41:55 +0200, "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:
>
>>On 2009-04-23 00:08, Robert Urban <urban@tru64.org> wrote:
>>> my $tmp = decode('utf8', $string, 1);
>>
>>[sets $string to ""]
>>
>>> What happened to $string?  There is no mention of side-effects in the Encode
>>> manpage...
>>
>>There is, but only for CHECK == FB_QUIET or FB_WARN, not for FB_CROAK
>>(1). 
>>
>>> This only happens when CHECK is set to 1.
>>
>>Nope, it also happens if CHECK is set to 4 (FB_QUIET) or 6 (FB_WARN).
>>But there it is documented.
>>
>>I'm not sure if this is a bug or an (undocumented) feature.
>>
>>	hp
>All programmers know its a feature, there are no bugs!
>
>-sln

All lapses in logic conciousness are features.

Einstein watched the clock as he sped away from it at/approaching light speed.
Apparently, the light was late getting there.
By the time, his time apparently, he saw the image,
it was an hour later than the actual time from the origination time.

Does that really mean he didn't age relative to the origination clock?

No it doesen't. Delta S of the universe is always >= 0.
Relativity is a ficticous math formula. For if Einstein to go back to where he
started observing the clock, he would be the same age as when he left, otherwise,
he would have to transport over great distances instantaneously.

Have a nice head trip!

-sln


------------------------------

Date: Thu, 23 Apr 2009 18:05:10 -0700
From: sln@netherlands.com
Subject: Re: Encode::decode() clears scalar being decoded?
Message-Id: <us32v45je6h27rg4ornoq8dbv1ikts2enj@4ax.com>

On Thu, 23 Apr 2009 17:57:02 -0700, sln@netherlands.com wrote:

>On Thu, 23 Apr 2009 15:01:31 -0700, sln@netherlands.com wrote:
>
>>On Thu, 23 Apr 2009 21:41:55 +0200, "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:
>>
>>>On 2009-04-23 00:08, Robert Urban <urban@tru64.org> wrote:
>>>> my $tmp = decode('utf8', $string, 1);
>>>
>>>[sets $string to ""]
>>>
>>>> What happened to $string?  There is no mention of side-effects in the Encode
>>>> manpage...
>>>
>>>There is, but only for CHECK == FB_QUIET or FB_WARN, not for FB_CROAK
>>>(1). 
>>>
>>>> This only happens when CHECK is set to 1.
>>>
>>>Nope, it also happens if CHECK is set to 4 (FB_QUIET) or 6 (FB_WARN).
>>>But there it is documented.
>>>
>>>I'm not sure if this is a bug or an (undocumented) feature.
>>>
>>>	hp
>>All programmers know its a feature, there are no bugs!
>>
>>-sln
>
>All lapses in logic conciousness are features.
>
>Einstein watched the clock as he sped away from it at/approaching light speed.
>Apparently, the light was late getting there.
>By the time, his time apparently, he saw the image,
>it was an hour later than the actual time from the origination time.
>
>Does that really mean he didn't age relative to the origination clock?
>
>No it doesen't. Delta S of the universe is always >= 0.
                                                   > 0
Sorry, my clock just isn't ticking. Its never equal from one time to the next.
Measurable? Thats where or equal is asumed in the engineering world, but its a convenience,
not a reality!

-sln


------------------------------

Date: Thu, 23 Apr 2009 13:32:01 -0700
From: sln@netherlands.com
Subject: Re: Exiting given via next
Message-Id: <0uj1v49h754gkf1536fv1dtd36dhsholmp@4ax.com>

On Thu, 23 Apr 2009 17:25:47 +0100, Ben Morrow <ben@morrow.me.uk> wrote:

> ~% perl -wE'LINE: for my $x (1..3) {
>            say $x;
>            given ($x) {
>                when (1) { next LINE }
>            }
>        }'

"Switching in a loop"  http://perldoc.perl.org/perlsyn.html
'Instead of using given() , you can use a foreach() loop'
'On exit from the when block, there is an implicit next'
 ...
'This doesn't work if you explicitly specify a loop variable,
 as in for $item (@array) . You have to use the default variable $_ .
 (You can use for my $_ (@array) .)'


I don't have 5.10 but try this and see what happens. Also try it in a .pl script.
If this craps out, then next LABEL is in doubt in given/when constructs.
They need to debug this stuff, its not stable. Thats why I stayed with 5.8.x for
a while longer.

-sln

 ~% perl -wE'LINE: for (1..3) {
            say $_;
                when ($_ == 1) { next LINE; }
            }
        }'



------------------------------

Date: Thu, 23 Apr 2009 14:47:32 -0700
From: sln@netherlands.com
Subject: Re: Exiting given via next
Message-Id: <0hl1v4113pc8l5upnbon8dlmrfhmumb7j6@4ax.com>

On Thu, 23 Apr 2009 10:03:55 -0700 (PDT), skendric@fhcrc.org wrote:

>ok, i've made a classic error here:  i over-simplified
>
>here's something a little closer to what i want to do (not guaranteed
>to work; i'm trying to stay conceptual here.  conceptually, i'm
>filtering a log file ... some lines are interesting, some are not, and
>i'm taking a tiered approach to skipping the uninteresting lines,
>throwing some away immediately, tossing others only after more
>detailed inspection)
>
>use feature 'switch;'
>use List::MoreUtils qw(any);
     ^^^^
seen it, never used it but get the jist in your usage below

>[...]
>LINE:
>while (my $line = <$fh>) {
>  next LINE if $line =~ /various patterns/;  # Skip obviously
   ^^^^
But you should really just use next with no label for now until
Perl gets its head out of its ...

>uninteresting lines
>
>  # This line might be interesting; if it is, save it; otherwise, skip
>to the next line
>  given ($line) {
>    when /\-fw/ {     # Firewalls
           ^
Is this really necessary?

>      next LINE if any { $line =~ /$_/ } @{$ignore{'Firewall'}};  # Actually, not interesting
                                    ^^
Be carefull here. given()'s default behavior is to asign $_ its simple parameter, you've just
overwritten it. There are exceptions though. Check given/when at http://perldoc.perl.org/perlsyn.html.

>      push @{$keep{'Firewall'}}, $line;

Now you are keeping $line and are breaking (by default) to the "OK, made it this far.." code, just past the
given() block.
>    }
>    when /\-rtr/ {    # Routers
     ^^^^
     when (/\-rtr/)
I don't know this construct yet so I'd feel funny giving the parser a chance to screw up my intention's when
I am debugging.
Each encounter with an apparent '-' option appears to be unique per line, which seems kind of strange.
Otherwise, with possible multiple options per line, you could have used the "fall through mechanism": continue statement,
instead of the next LINE, thereby taking you to the default block which does the next line.
If thats the case, and you have multiple options per line though, some options are interresting and some aren't,
after a push but before a continue, $interresting |= (bit) will mitigate in the default block to bump the next line or continue
processing in the "OK, made it this far.." code.

>      next LINE if any { $line =~ /$_/ } @{$ignore{'Firewall'}};  # Actually, not interesting
>      push @{$keep{'Router'}}, $line;

Again, breaking to the "OK.." code.

>    }
>    [...]
>    default {
>      next LINE;   # Turns out that this line isn't interesting after all, skip to the next one
       ^^^^
       next if !$interresting;

Otherwise your breaking out of the given () block.
Like mentioned, if multiple options per line, you are interrested here in one, some or all, depending on the
$interresting bit map you set in the when() blocks. This would be checked in another given/when (or if/then construct)
withing the "OK..." code path below.

>    }
>  }
>
>  # OK, if I've made it this far, this line is interesting to me in various ways

So, check the $interresting bit map to see what is of interrest, then act upon it.

>  # Do more processing here
>  [...]
>
>}

-sln



------------------------------

Date: Thu, 23 Apr 2009 19:32:25 -0300
From: "Guy" <someone@somewhere.nb.ca>
Subject: Re: Is there a better way to convert foreign characters?
Message-Id: <49f0ec66$0$5500$9a566e8b@news.aliant.net>


"Guy" <someone@somewhere.nb.ca> a écrit dans le message de news: 
49eb9efd$0$5500$9a566e8b@news.aliant.net...
> I'm sure there are many ways to do this, but is there a much better way?
>
> $value=~tr/àâÀéèëêÉÊçÇîïôÔùû/aaaeeeeeecciioouu/;
> $word=lc($value);
>
> I want $word to equal the english version of $value.  So if 
> $value="Théodore", I want $word="theodore".  I'd like to do it in one 
> statement if possible but I think I have to convert $value in one 
> statement and then assign it to $word in another statement.
>
> Cheers!
> Guy

Just to explain a little.  I have a few hundred old pictures of this city 
from the 1900 to 1940, when the city was just a town of about 100 houses. I 
want to allow the local population to search through the photos, perhaps 
find their grand-parents or even great-grand-parents.  Like today, many of 
the folks back then were french, with names like "Roméo" or "Théodore". 
Despite this, most people here have english keyboards and I suspect that 
many don't even know how to type french characters like "é".  Therefore, I 
suspect that people will just search for "Theodore" or "Romeo", and perhaps 
in lowercase too, such as "theodore" or "romeo". The names are just english 
and french, nothing else, at least not in this project. Thanks for all,
Guy




------------------------------

Date: Fri, 24 Apr 2009 00:19:48 +0200
From: News123 <news123@free.fr>
To: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Is there a module to transliterate Russian and Ukrainian cyrillic unicode to phonetic ASCII?
Message-Id: <49F0E984.1020707@free.fr>

RedGrittyBrick wrote:
> 
> News123 wrote:
>
>> I'd like to translate some cyrillic file names into file names, that are
>> ASCII only.
> 
> I wonder why? AFAIK the most commonly used operating systems nowadays
> use Unicode for filenames. Of course this doesn't help if you don't have
> fonts and input methods for the character ranges in question.
> 
Old portable mp3 players, old DVD-players / car stereos / and stereos
being capable of playing mp3s are not really  'gifted'  playing much
more then ASCII some even refuse / skip cyrillic file names.

Unicode::Transliterate sounds to be the right thing.I'll look into it.


The mediaplayers on my PC are absolutely happy with Unicode/UTF-8
They just struggle with cyrillic non unicode tags / file names (windows
1252 coding or alike)


------------------------------

Date: Fri, 24 Apr 2009 00:20:01 +0200
From: News123 <news123@free.fr>
Subject: Re: Is there a module to transliterate Russian and Ukrainian cyrillic unicode to phonetic ASCII?
Message-Id: <49f0e991$0$7877$426a74cc@news.free.fr>

RedGrittyBrick wrote:
> 
> News123 wrote:
>
>> I'd like to translate some cyrillic file names into file names, that are
>> ASCII only.
> 
> I wonder why? AFAIK the most commonly used operating systems nowadays
> use Unicode for filenames. Of course this doesn't help if you don't have
> fonts and input methods for the character ranges in question.
> 
Old portable mp3 players, old DVD-players / car stereos / and stereos
being capable of playing mp3s are not really  'gifted'  playing much
more then ASCII some even refuse / skip cyrillic file names.

Unicode::Transliterate sounds to be the right thing.I'll look into it.


The mediaplayers on my PC are absolutely happy with Unicode/UTF-8
They just struggle with cyrillic non unicode tags / file names (windows
1252 coding or alike)


------------------------------

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 2363
***************************************


home help back first fref pref prev next nref lref last post