Ask a Question related to PERL Miscellaneous, Design and Development.
-
YAPoster #1
transforming an explicit range based on implicit exceptions
i have this problem:
i have an explit range, say:
$range = "1-1000";
and implicit exceptions to it, say:
$excepts = "3,5-7,12,14,16-18..."
how do i convert $range into:
$newrange = "1,2,8-11,13,15,19..."
with efficiency in time and processing at a premium.
thanks.
YAPoster Guest
-
Transforming locked objects
When I apply "find and replace" " rotate" effect to a selection of large number of objects, locked objects are also getting rotated. I do not want... -
explicit vs implicit syntax
Is it really bad practice oneway or another with calling sub? &doMe; &doMe(); doMe; doMe(); Please explain in terms of performance and... -
#24909 [Fbk->Opn]: rand function with range always returns low value of range
ID: 24909 User updated by: a0 at hush dot com Reported By: a0 at hush dot com -Status: Feedback +Status: ... -
#24909 [Opn->Fbk]: rand function with range always returns low value of range
ID: 24909 Updated by: iliaa@php.net Reported By: a0 at hush dot com -Status: Open +Status: Feedback... -
#24909 [NEW]: rand function with range always returns low value of range
From: a0 at hush dot com Operating system: solaris 8 PHP version: 4.3.2 PHP Bug Type: Math related Bug description: rand... -
Kien Ha #2
Re: transforming an explicit range based on implicit exceptions
YAPoster wrote:
4 is missing here I hope> i have this problem:
> i have an explit range, say:
>
> $range = "1-1000";
> and implicit exceptions to it, say:
> $excepts = "3,5-7,12,14,16-18..."
> how do i convert $range into:
>
> $newrange = "1,2,8-11,13,15,19..."don't know about the "time efficiency" though, and here>
> with efficiency in time and processing at a premium.
>
> thanks.
is OWTDI using Bit::Vector module
#!/usr/bin/perl
use strict;
use warnings;
use Bit::Vector;
my ($range, $excepts) = (1001, "0,3,5-7,12,14,16-18");
my $v = Bit::Vector->new_Enum($range, $excepts);
$v->Flip;
my $newrange = $v->to_Enum;
print "\$newrange = $newrange\n";
Have fun reading the long doc. of Bit::Vector,
but it sure is a good one. :-)
Kien Ha Guest



Reply With Quote

