Re: "my", "strict", and function references

2001-07-28 Thread Dan Grossman

On Sat, 28 Jul 2001, Jeff 'japhy/Marillion' Pinyan wrote:

> On Jul 28, Dan Grossman said:
> 
> >#!/usr/bin/perl -w
> >use strict;
> >
> >my $funcRef = \&otherDummyFunc;
> >
> >sub callTheReferredFunc {
> >my $returnVal = &$funcRef;
> >return $returnVal;
> >}
> 
> >I don't pass $funcRef to &callTheReferredFunc, and yet "-w" doesn't
> >generate a warning for an undefined reference.  Are function
> >references somehow global in nature?  This doesn't seem to be true of,
> >say, variable references.
> 
> You're confusing something here, and I can't tell what it is.  
> The variable $funcRef is NOT global -- it is lexically scoped
> (because you used my() on it).  It is not visible OUTSIDE the
> scope that you declared it in -- but it IS visible inside smaller
> scopes, like the one of the callTheReferredFunc() function.

Ah, I see what my problem was.  I was aware of the relevant scoping
issues but had also tried the following, which generated an error
message (whereas the previous code had not):

--
my $dummyVar = 1;
my $varRef = \$dummyVar;

my $oneVar = &dummyFunc();
print $oneVar,"\n";

sub dummyFunc {
my $returnVal = &$varRef;   # <-- note the typo
return $returnVal;
}
--

I was trying to figure out what the heck the difference is between a
reference to a function and a reference to a variable that would cause
Perl to like one but not the other when accessed inside the function.  
Of course, I had meant to type "$$varRef" inside the function, rather
than "&$varRef" ...

Thanks,
Daniel


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: "my", "strict", and function references

2001-07-28 Thread Jeff 'japhy/Marillion' Pinyan

On Jul 28, Dan Grossman said:

>#!/usr/bin/perl -w
>use strict;
>
>my $funcRef = \&otherDummyFunc;
>
>sub callTheReferredFunc {
>my $returnVal = &$funcRef;
>return $returnVal;
>}

>I don't pass $funcRef to &callTheReferredFunc, and yet "-w" doesn't
>generate a warning for an undefined reference.  Are function
>references somehow global in nature?  This doesn't seem to be true of,
>say, variable references.

You're confusing something here, and I can't tell what it is.  The
variable $funcRef is NOT global -- it is lexically scoped (because you
used my() on it).  It is not visible OUTSIDE the scope that you declared
it in -- but it IS visible inside smaller scopes, like the one of the
callTheReferredFunc() function.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
http://www.perlmonks.com/  http://search.cpan.org/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl regex book  **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: "my", "strict", and function references

2001-07-28 Thread Walt Mankowski

On Sat, Jul 28, 2001 at 07:10:59PM -0700, Dan Grossman wrote:
> I'm wondering why Perl doesn't complain about the following code:
> 
> --
> #!/usr/bin/perl -w
> use strict;
> 
> my $funcRef = \&otherDummyFunc;
> my $oneVar = &callTheReferredFunc();
> print $oneVar;
> 
> sub dummyFunc {
> return 42;
> }
> 
> sub otherDummyFunc {
> return "your mom";
> }
> 
> sub callTheReferredFunc {
> my $returnVal = &$funcRef;
> return $returnVal;
> }
> --
> 
> Output: your mom
> 
> I don't pass $funcRef to &callTheReferredFunc, and yet "-w" doesn't
> generate a warning for an undefined reference.  Are function
> references somehow global in nature?  This doesn't seem to be true of,
> say, variable references.
> 
> I'm clearly missing something.  Explanations would be helpful ...

Since $funcRef isn't declared inside a block, it's global to the
entire file.

For more information, perldoc perlsub and look for the section
entitled "Private Variables via my()".  You might also want to read
Mark-Jason Dominus's article "Coping With Scoping", available on the
web at http://perl.plover.com/FAQs/Namespaces.html

Walt


 PGP signature


"my", "strict", and function references

2001-07-28 Thread Dan Grossman

Hi,

I'm wondering why Perl doesn't complain about the following code:

--
#!/usr/bin/perl -w
use strict;

my $funcRef = \&otherDummyFunc;
my $oneVar = &callTheReferredFunc();
print $oneVar;

sub dummyFunc {
return 42;
}

sub otherDummyFunc {
return "your mom";
}

sub callTheReferredFunc {
my $returnVal = &$funcRef;
return $returnVal;
}
--

Output: your mom

I don't pass $funcRef to &callTheReferredFunc, and yet "-w" doesn't
generate a warning for an undefined reference.  Are function
references somehow global in nature?  This doesn't seem to be true of,
say, variable references.

I'm clearly missing something.  Explanations would be helpful ...

Thanks,
Daniel


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Script for Sheduling jobs on NT

2001-07-28 Thread Walt Mankowski

On Sat, Jul 28, 2001 at 01:56:46PM +0200, Ackim Chisha wrote:
> Does any one already have a perl script for NT that I could use to run like
> a cron job in unix.  Am writing a scrip that I need to have running every 5
> minuteseveryday. Or is there a way I can write my script so that it runs
> every 5 minutes. Task sheduler on NT looks like it cant help run my script
> every 5minutes everyday.
> 
> Any help will be appreciated.

Three thoughts:

1.  Schedule at jobs to run your script every five minutes.

$script_path = 'c:\path\to\myscript.pl';
for $hour (0..23) {
  for ($min = 0; $min < 60; $min += 5) {
$cmd = sprintf ("at %02d:%02d /e:m,t,w,th,f,sa,su %s",
$hour, $min, $script_path);
system($cmd);
  }
}

2.  Have your script run in an infinite loop.  At the bottom of the
loop, sleep until 5 minutes are up:

$five_minutes = 5 * 60;
while (1) {
  $start_time = time;
  do_stuff;
  sleep($five_minutes - (time - $start_time));
}

3.  Search the net for a Windows-native cron program, of which I'm
sure there must be a bunch.

Walt



 PGP signature


Re: jpg resize

2001-07-28 Thread Agustin Bialet

You shoul check PerlMagick on CPAN.
It can modify any image in a lot of ways..


-- 
Agustin Bialet
Macaldia.com
Av del Libertador 498 - 6 piso Norte
(011) 4328-8844


> From: <[EMAIL PROTECTED]>
> Date: Fri, 27 Jul 2001 12:58:07 -0700 (PDT)
> To: <[EMAIL PROTECTED]>
> Subject: jpg resize
> 
> I need to resize a slew of jpgs I have in archive.  They are 1024x768, way
> too big for web viewing.  I need them smaller, around 300x200.
> 
> Is there a module I should look into for graphic resizing?  Is this
> possible with PERL?  Where should I go to look at example scripts?
> 
> any thoughts would make my day.
> 
> Thank you all!
> 
> Todd
> aimatme.com
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Artistic License Essay

2001-07-28 Thread Adam Theo

Hello, all.

I have put together a very rough draft of what I hope to be a very good
introduction and description of Perl's Original Artistic License. I've
just put it together using a variety of readily findable sources, and
has not been refined at all at this point.

I would like anyone here that is familiar with the license (not only
pros and cons, but also history and concepts behind it) to please take a
look at what I have done at this point, and provide feedback. I would
appreciate and eagerly welcome as detailed as possible. This will be
it's first round of critiquing, so I am very open to even radical
changes to it (such as layout, content, focus, etc.). Please, tell me
what you know and what you think.

http://www.theoretic.com/bazaar/oal.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




re: Script for Sheduling jobs on NT

2001-07-28 Thread Steve Howard



AT is part of the standard installation on NT4. There is no need to install
it separately. If the schedule service is running on the remote machine, and
your account has rights on it, just designate the remote machine between the
AT and the time like this from command prompt:

at \\remotemachine 23:30 /every:monday c:\tasks\myscript.pl

Type at /? to get all the options.

Steve H.

-Original Message-
From: SunDog [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 28, 2001 1:48 PM
To: Ackim Chisha
Cc: [EMAIL PROTECTED]
Subject: Re: Script for Sheduling jobs on NT


Hey Ackim,

   The NT Resoure Kit provides an "AT" scheduler ...
   Just install it, configure your command script and
   identify the run times ...

   Unless you do not have Local Admin access to this NT server,
   there is no need to re-write a scheduler ...

regards

SunDog
=

At 01:56 PM 7/28/01 +0200, you wrote:
>Does any one already have a perl script for NT that I could use to run like
>a cron job in unix.  Am writing a scrip that I need to have running every 5
>minuteseveryday. Or is there a way I can write my script so that it runs
>every 5 minutes. Task sheduler on NT looks like it cant help run my script
>every 5minutes everyday.
>
>Any help will be appreciated.
>
>Thanks
>Ackim
>
>
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: (MORE INFO) loose matching with regex

2001-07-28 Thread Me

> search for 'efghmnop'
> in 'abcdefghijklmnopqrstuvwxyzabcdefghmnop'
> 
> Take the last letter of the searched for substring, p.
> 
> Pick a possible substring endpoint in the large string.
> This starts out at an offset from the beginning of the
> large string. The offset is the length of the substring.
> 
> So, in the above case, you start by comparing p and h.
> 
> That fails. Next, given that there is no l in the substring,

Oops. I'll leave working out the paragraph I accidentally
deleted as an exercise to readers...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Script for Sheduling jobs on NT

2001-07-28 Thread Steve Howard

Almost right. Windows 2000 has a scheduler in the control panel, and you can
set a single schedule to run every 5 minutes from a start time to a stop
time every day by using a weekly schedule. This has a front end GUI, but
still works with the legacy AT like in NT4. However using the AT may not be
what you want to do for something to run every 5 minutes. However, many
other programs that may be loaded on the computer have schedulers built into
them (one good example is the SQLServerAgent with SQL 7 etc.)

However, to schedule something on the local machine using at you can do
this:

at 23:30 /every:monday,tuesday,wednesday,thursday,friday,saturday,sunday
c:\tasks\myscript.pl

(example to schedule a single job to run at 11:30 pm every day).

Works fine for something like that, but not too good for something you need
to schedule every 5 minutes.

However, as a possibility to handle that, you might include include a line
as the last line in your script to schedule the next run for 5 minutes after
after current time or something like that. Just use shell or back ticks to
run the line to schedule the next run.

Steve H.

-Original Message-
From: Steven Yarbrough [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 28, 2001 3:22 PM
To: [EMAIL PROTECTED]
Subject: Re: Script for Sheduling jobs on NT


Windows NT/2000 built-in scheduler, the "at" program, will work, I
believe, but if your script is to run every 5 minutes, you might
simply use Perl's sleep command to time iterations of some loop.
That way the script's process won't have to start and stop
repeatedly.  It will simply wait in the background until it's ready
to run again.

Steven Yarbrough ([EMAIL PROTECTED])



>Why don't you try the built-in scheduling program in NT?  best bet.  Then
>have it run the specified script when you want.
>
>
>- Original Message -
>From: "Ackim Chisha" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Saturday, July 28, 2001 7:56 AM
>Subject: Script for Sheduling jobs on NT
>
>
>>  Does any one already have a perl script for NT that I could use to run
>like
>>  a cron job in unix.  Am writing a scrip that I need to have running
every
>5
>>  minuteseveryday. Or is there a way I can write my script so that it runs
>>  every 5 minutes. Task sheduler on NT looks like it cant help run my
script
>>  every 5minutes everyday.
>>
>>  Any help will be appreciated.
>>
>>  Thanks
>>  Ackim
>>
>>
>>
>>
>>  --
>>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>_
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

--

_
"We are in the midst of husked coconuts; the basement is downstairs."
Steven Yarbrough -- http://ebstern.freehosting.net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




File locking question.

2001-07-28 Thread h1kv27q1mkye6001


I am trying to use L Stein's file locking subroutine from 'Official Guide
to Programming with CGI.pm' for a light duty cgi program I am writing. I'd
like to use 'use strict', but I can't get perl to agree with the return
at the end of the subroutine. (See return below)

Here is a sample program:

***

#!/usr/local/bin/perl

#use strict;
use warnings;

my $file = 'data';
my $TIMEOUT = 10;
sub LOCK_SH { 1 };
sub LOCK_EX { 2 };
sub LOCK_UN { 8 };

sub filelock ($$) {
my $path = shift;
my $for_writing = shift;

my ($lock_type,$path_name,$description);
if ($for_writing) {
$lock_type = LOCK_EX;
$path_name = ">>$path";
$description = 'writing';
} else {
$lock_type = LOCK_SH;
$path_name = $path;
$lock_type = LOCK_SH;
$path_name = $path;
$description = 'reading';
}

my ($msg,$oldsig);
my $handler = sub { $msg='timed out'; $SIG{ALRM}=$oldsig; };
($oldsig,$SIG{ALRM}) = ($SIG{ALRM},$handler);
alarm($TIMEOUT);

open (FH,$path_name) or
   warn("Couldn't open $path for $description: $!"), return undef;

# now try to lock it
unless (flock (FH,$lock_type)) {
   warn("Couldn't get lock for $description (" . ($msg || "$!") . ")");
   alarm(0);
   close FH;
   return undef;
   close FH;
   return undef;
}

alarm(0);
return FH;   # error from perl -cw is: Bareword "FH" not allowed while
 # "strict subs" in use at sample line 47.
}

sub fileunlock {
my $fh = shift;
flock($fh,LOCK_UN);
close $fh;
}

my $fh = &filelock($file,1);

print $fh "testing\n";

&fileunlock($fh);

***

What do I need to change to allow 'use strict;' to bless this subroutine??
Or, is there a better way to prevent two writes from clobbering one
another?

Thanks,
Eric


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: (MORE INFO) loose matching with regex

2001-07-28 Thread Me

> Like I said I know I can use the module Similarity. But in
> order to do this I would need bot the query and the subject
> string. And to get the subject string I would need to 'slide'
> down the larger string and pull out all combinations 1 by 1.
> This is very slow with a 4.5 million character string. I'm just
> looking for a way to speed things up.

You might want to use a variant of Boyer-Moore's algorithm.

Dunno how best BM could be fitted to your case, but I am
pretty sure some variant would work, and could, in principal
at least, give you something like a 100 to, what, 10,000?,
fold speed up.

BM basically has you match the substrings backwards and
take advantage of what you know when this fails. Some
variants add a twist that focuses on elements of the
substring that are (likely to be) infrequent in the large
string.

Here's a simplified version of BM that ignores the fuzzy
aspects of your search:

search for 'efghmnop'
in 'abcdefghijklmnopqrstuvwxyzabcdefghmnop'

Take the last letter of the searched for substring, p.

Pick a possible substring endpoint in the large string.
This starts out at an offset from the beginning of the
large string. The offset is the length of the substring.

So, in the above case, you start by comparing p and h.

That fails. Next, given that there is no l in the substring,
you move the end point in the large string forward to the
length of the substring past the l. Then, because you
also know that that is followed by mnop, and the first
4 characters of the substring are not mnop, you move
the endpoint forward by another 4 characters.

Now you compare p and x. That fails. There's no x in
the substring, so compare p and f. That fails. Now, f
is the second character in the substring. So move the
possible end point forward by the length of the substring
minus 2.

Now compare p and p, then all the way backwards for
a match.

Modifications of BM do things like instead of picking
the last character, picking a character that is weighted
according to how far along the substring it is and how
infrequently it occurs in the large string.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Script for Sheduling jobs on NT

2001-07-28 Thread Steven Yarbrough

Windows NT/2000 built-in scheduler, the "at" program, will work, I 
believe, but if your script is to run every 5 minutes, you might 
simply use Perl's sleep command to time iterations of some loop. 
That way the script's process won't have to start and stop 
repeatedly.  It will simply wait in the background until it's ready 
to run again.

Steven Yarbrough ([EMAIL PROTECTED])



>Why don't you try the built-in scheduling program in NT?  best bet.  Then
>have it run the specified script when you want.
>
>
>- Original Message -
>From: "Ackim Chisha" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Saturday, July 28, 2001 7:56 AM
>Subject: Script for Sheduling jobs on NT
>
>
>>  Does any one already have a perl script for NT that I could use to run
>like
>>  a cron job in unix.  Am writing a scrip that I need to have running every
>5
>>  minuteseveryday. Or is there a way I can write my script so that it runs
>>  every 5 minutes. Task sheduler on NT looks like it cant help run my script
>>  every 5minutes everyday.
>>
>>  Any help will be appreciated.
>>
>>  Thanks
>>  Ackim
>>
>>
>>
>>
>>  --
>>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>_
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

-- 
_
"We are in the midst of husked coconuts; the basement is downstairs."
Steven Yarbrough -- http://ebstern.freehosting.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: (MORE INFO) loose matching with regex

2001-07-28 Thread Abdulaziz Ghuloum

Hello again,

I have no background in genetic analysis but it looks like there is so
much effort going on in the Bio:: modules.  There is a module called 
Bio::SeqFeature::Similarity that might be doing just what you want.  But
then again, it may not :-)

Hope this helps,,,

Aziz,,,


In article <[EMAIL PROTECTED]>, "Bob
Mangold" <[EMAIL PROTECTED]> wrote:
> BTW, if it helps at all, I'm doing genetic analysis of whole genomes,
> hence the 4.5 million long string.
> 
> -Bob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Script for Sheduling jobs on NT

2001-07-28 Thread M. Buchanan

Why don't you try the built-in scheduling program in NT?  best bet.  Then
have it run the specified script when you want.


- Original Message -
From: "Ackim Chisha" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 28, 2001 7:56 AM
Subject: Script for Sheduling jobs on NT


> Does any one already have a perl script for NT that I could use to run
like
> a cron job in unix.  Am writing a scrip that I need to have running every
5
> minuteseveryday. Or is there a way I can write my script so that it runs
> every 5 minutes. Task sheduler on NT looks like it cant help run my script
> every 5minutes everyday.
>
> Any help will be appreciated.
>
> Thanks
> Ackim
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: (MORE INFO) loose matching with regex

2001-07-28 Thread Abdulaziz Ghuloum

Hello again,

I would suggest you look at Algorithm::Diff module (available at CPAN).
The function LCS, given 2 strings, gives you the "longest common
sequence" between the 2 strings.  Once you have the longest common
sequence, you can probably decide whether it meets the 80% criterion you
set or not.  

I don't know anything about the effeciency of this module when it comes
to big data but give it a shot and see if it helps you.  If it's doing
what you need but is too slow, look at the code to see how it works, and
you might find it easy to reimplement in C using the Inline::C module.

Hope this helps,,,

Aziz,,,

In article <[EMAIL PROTECTED]>, "Bob
Mangold" <[EMAIL PROTECTED]> wrote:

> Aziz,
> 
> I guess I hadn't thought about it that way, so here is more info.
> 
> What I'm basically doing is randomly pulling a string of 500 from one
> string and looking for it in another string. So I'm looking for a
> substring of the larger string that matches my query string. In terms of
> how it matches the answer and to your questions, all of the above. I
> don't care if there are insertions, deletions of just character changes,
> as long as the query sting is 80% similar to the subject string.
> 
> Like I said I know I can use the module Similarity. But in order to do
> this I would need bot the query and the subject string. And to get the
> subject string I would need to 'slide' down the larger string and pull
> out all combinations 1 by 1. This is very slow with a 4.5 million
> character string. I'm just looking for a way to speed things up.
> 
> BTW, if it helps at all, I'm doing genetic analysis of whole genomes,
> hence the 4.5 million long string.
> 
> -Bob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: (MORE INFO) loose matching with regex

2001-07-28 Thread Bob Mangold

Aziz,

I guess I hadn't thought about it that way, so here is more info.

What I'm basically doing is randomly pulling a string of 500 from one string
and looking for it in another string. So I'm looking for a substring of the
larger string that matches my query string. In terms of how it matches the
answer and to your questions, all of the above. I don't care if there are
insertions, deletions of just character changes, as long as the query sting is
80% similar to the subject string.

Like I said I know I can use the module Similarity. But in order to do this I
would need bot the query and the subject string. And to get the subject string
I would need to 'slide' down the larger string and pull out all combinations 1
by 1. This is very slow with a 4.5 million character string. I'm just looking
for a way to speed things up.

BTW, if it helps at all, I'm doing genetic analysis of whole genomes, hence the
4.5 million long string.

-Bob

--- Abdulaziz Ghuloum <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> I don't have a direct answer for your question since your question is a
> little bit ambigious; let me explain:
> 
> Do you want to search for a substring in a long string, or you want true
> regexp match?
> 
> If you want a true regexp match, then the question is even more
> ambigious.  For example, the regexp /(ab){20}a{10}/ does not match the
> string "ababababababa", but what percentage does it match?  How
> do you determine the percentage let alone matching for a given error
> percentage.
> 
> If you just want a substring match (not a regexp), then your problem is
> simpler, but you need to define your criteria more clearly.
> 
> Do you want to allow up to 20% more characters to be inserted to the
> substring and still consider it a match?
> 
> Do you want to match down to 80% of the substring and still consider it a
> match?
> 
> Do you want to allow up to 20% of the characters to be altered (not
> removed or inserted) and still consider it a match?
> 
> Or a combination of the above?
> 
> Without this information, no reply is even remotely correct.  Please
> provide more information about the problem to get closer to the solution
> to your problem.
> 
> Hope this helps,,,
> 
> Aziz,,, 
> 
> In article <[EMAIL PROTECTED]>, "Bob
> Mangold" <[EMAIL PROTECTED]> wrote:
> 
> > Hello,
> > 
> > I'm working on a program where I am searching for a short string within
> > a longer string. The catch is that the long string is about 4.5 million
> > chars long and the short string is about 500. Using a regex to do an
> > exact match is simple, but what if I want just a close match, like 80%
> > or whatever. I've used the module Similarity in the past, but in order
> > to use that I have to send it two string to compare, which means I'd
> > have to slide down the longer string character by character. Is there a
> > faster way. Is there a module that returns true for a regex match within
> > a certain percentage?
> > 
> > -Bob
> > 
> > __ Do You Yahoo!?
> > Make international calls for as low as $.04/minute with Yahoo! Messenger
> > http://phonecard.yahoo.com/
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




A Munging Project

2001-07-28 Thread Ron Smith

Hi all,

I've been handed a project where I have to read the contents of several 
files, which looks like the following:

file.0001.rgb
file.0002.rgb
file.0003.rgb
file.0004.rgb
file.0005.rgb
file_2.0001.rgb
file_2.0002.rgb
file_2.0003.rgb

then replace the contents of those files with the same info in the following 
format:

1  file.%04d.rgb1-5
2  file_2.%04d.rgb  1-3

Are there any modules I should be looking at that could make this job 
easier?

Ron


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: loose matching with regex

2001-07-28 Thread Abdulaziz Ghuloum

Hello,

I don't have a direct answer for your question since your question is a
little bit ambigious; let me explain:

Do you want to search for a substring in a long string, or you want true
regexp match?

If you want a true regexp match, then the question is even more
ambigious.  For example, the regexp /(ab){20}a{10}/ does not match the
string "ababababababa", but what percentage does it match?  How
do you determine the percentage let alone matching for a given error
percentage.

If you just want a substring match (not a regexp), then your problem is
simpler, but you need to define your criteria more clearly.

Do you want to allow up to 20% more characters to be inserted to the
substring and still consider it a match?

Do you want to match down to 80% of the substring and still consider it a
match?

Do you want to allow up to 20% of the characters to be altered (not
removed or inserted) and still consider it a match?

Or a combination of the above?

Without this information, no reply is even remotely correct.  Please
provide more information about the problem to get closer to the solution
to your problem.

Hope this helps,,,

Aziz,,, 

In article <[EMAIL PROTECTED]>, "Bob
Mangold" <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I'm working on a program where I am searching for a short string within
> a longer string. The catch is that the long string is about 4.5 million
> chars long and the short string is about 500. Using a regex to do an
> exact match is simple, but what if I want just a close match, like 80%
> or whatever. I've used the module Similarity in the past, but in order
> to use that I have to send it two string to compare, which means I'd
> have to slide down the longer string character by character. Is there a
> faster way. Is there a module that returns true for a regex match within
> a certain percentage?
> 
> -Bob
> 
> __ Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: code doesn't work

2001-07-28 Thread Akshay Arora

@temp=; #implies that TEMP is a read file handle
print TEMP @temp; #implies that TEMP is a write file handle.

I'm pretty sure that you can only do either read or write, but not both
to the same FILE HANDLE. You can open 2 handles to the same file (which
can cause a few problems...), but if you are trying to write to a 2nd
file, use a different file handle

open(TEMP,">file"); #append mode
@temp = ;
...
print TEMP2 @temp; 
#poor use of variable all around, but you get the point.

-Akshay

COLLINEAU Franck FTRD/DMI/TAM wrote:
> 
> this code doesn't work:
> 
> @temp=;
> $temp[2]="";
> $temp[3]="";
> $temp[4]="";
> $temp[5]="";
> print TEMP @temp;
> 
> The error message is "Use of uninitialized value in print at 01_info.pl line
> 25,  line 1."
> 
> can anybody help me ?
> 
> Franck
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
http://www.5vs1.com - A Pearl Jam Fan Site

"Only when the last tree is dead, the last river damned, and the last
field paved, will we realize that we can't eat money."

"Time is long and life is short, so begin to live while you still can."
-Eddie Vedder

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: regexp issues TR

2001-07-28 Thread Abdulaziz Ghuloum

Hello,

I believe you don't need the /g modifier in that regexp since a single
match to an unwanted character is enough.

Aziz,,,

In article
<[EMAIL PROTECTED]>,
"Wagner-David" <[EMAIL PROTECTED]> wrote:

> Here is some code which does what you want:
> 
> #!perl -w
> # A-Za-z0-9_@.-
> 
> while ( 1 ) {
>printf "Please enter data: ";
>chomp(my $Input = );
>last if ( $Input=~ /^ex/i );
>if ( $Input =~ /[^\w\d\_@.\-\s]/g ) {
>   printf "You entered something other than the following:\n"; printf
>   " A-Z a-z 0-9 _ \@ . -\n";
>   printf "You entered: <$Input>\n";
>   printf "Correct and re-enter\n";
> }else {
>   printf "Good data entered!\n";
> }
>  }
> 
> Wags ;)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




loose matching with regex

2001-07-28 Thread Bob Mangold

Hello,

I'm working on a program where I am searching for a short string within a
longer string. The catch is that the long string is about 4.5 million chars
long and the short string is about 500. Using a regex to do an exact match is
simple, but what if I want just a close match, like 80% or whatever. I've used
the module Similarity in the past, but in order to use that I have to send it
two string to compare, which means I'd have to slide down the longer string
character by character. Is there a faster way. Is there a module that returns
true for a regex match within a certain percentage?

-Bob

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: regexp issues TR

2001-07-28 Thread Wagner-David

Here is some code which does what you want:

#!perl -w
# A-Za-z0-9_@.-

while ( 1 ) {
   printf "Please enter data: ";
   chomp(my $Input = );
   last if ( $Input=~ /^ex/i );
   if ( $Input =~ /[^\w\d\_@.\-\s]/g ) {
  printf "You entered something other than the following:\n";
  printf " A-Z a-z 0-9 _ \@ . -\n";
  printf "You entered: <$Input>\n";
  printf "Correct and re-enter\n";
}else {
  printf "Good data entered!\n";
}
 }

Wags ;)

-Original Message-
From: Teresa Raymond [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 28, 2001 08:59
To: [EMAIL PROTECTED]
Subject: Re: regexp issues TR


Let me rephrase what I want to do since I was so unclear the first 
time:  I want to output an error message every time the input 
includes characters that are not the following: A-Za-z0-9_@.- or a 
space(s).

At this point, I've tried:

if ($params{$i} !~ /[^\w\@.-\s]/g) {
print "Error Message";
}
#output: prints error msg every time

unless ($params{$i} =~ /[^\w\@.-\s]/g) {
print "Error Message";
}
#output: prints error msg every time

if ($params{$i}=~m/^[\W&&[\@]&&[.]&&[-]]+$/g) {
print "Error Message";
}
#output: evaluates false with unallowed chars, never prints error msg

>On Jul 25, Teresa Raymond said:
>
>>I tried the following code to test for bad characters but keep
>>getting my error msg though the values passed do not contain chars
>>that are not "A-Za-z0-9_@.-" (I also reread my last post and found
>>that my English articulation was very poor, I'm grateful that anyone
>>responded!).
>
>You're using !=, when you "meant" to use !~, but you really want to use =~
>
>>{if ($params{$i}!=m/[^\w@.-]/g)
>
>  if ($params{$i} =~ /[^\w\@.-]/) {
># badness
>  }
>
>--
>Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
>I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
>Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
>Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
>Acacia Fraternity, Rensselaer Chapter. Brother #734
>**  Manning Publications, Co, is publishing my Perl Regex book  **

*** Teresa Raymond
*** http://www.mariposanet.com
*** [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: regexp issues TR

2001-07-28 Thread Teresa Raymond

Let me rephrase what I want to do since I was so unclear the first 
time:  I want to output an error message every time the input 
includes characters that are not the following: A-Za-z0-9_@.- or a 
space(s).

At this point, I've tried:

if ($params{$i} !~ /[^\w\@.-\s]/g) {
print "Error Message";
}
#output: prints error msg every time

unless ($params{$i} =~ /[^\w\@.-\s]/g) {
print "Error Message";
}
#output: prints error msg every time

if ($params{$i}=~m/^[\W&&[\@]&&[.]&&[-]]+$/g) {
print "Error Message";
}
#output: evaluates false with unallowed chars, never prints error msg

>On Jul 25, Teresa Raymond said:
>
>>I tried the following code to test for bad characters but keep
>>getting my error msg though the values passed do not contain chars
>>that are not "A-Za-z0-9_@.-" (I also reread my last post and found
>>that my English articulation was very poor, I'm grateful that anyone
>>responded!).
>
>You're using !=, when you "meant" to use !~, but you really want to use =~
>
>>{if ($params{$i}!=m/[^\w@.-]/g)
>
>  if ($params{$i} =~ /[^\w\@.-]/) {
># badness
>  }
>
>--
>Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
>I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
>Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
>Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
>Acacia Fraternity, Rensselaer Chapter. Brother #734
>**  Manning Publications, Co, is publishing my Perl Regex book  **

*** Teresa Raymond
*** http://www.mariposanet.com
*** [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Script for Sheduling jobs on NT

2001-07-28 Thread SunDog

Hey Ackim,

   The NT Resoure Kit provides an "AT" scheduler ...
   Just install it, configure your command script and
   identify the run times ...

   Unless you do not have Local Admin access to this NT server,
   there is no need to re-write a scheduler ...

regards

SunDog
=

At 01:56 PM 7/28/01 +0200, you wrote:
>Does any one already have a perl script for NT that I could use to run like
>a cron job in unix.  Am writing a scrip that I need to have running every 5
>minuteseveryday. Or is there a way I can write my script so that it runs
>every 5 minutes. Task sheduler on NT looks like it cant help run my script
>every 5minutes everyday.
>
>Any help will be appreciated.
>
>Thanks
>Ackim
>
>
>
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Script for Sheduling jobs on NT

2001-07-28 Thread Ackim Chisha

Does any one already have a perl script for NT that I could use to run like
a cron job in unix.  Am writing a scrip that I need to have running every 5
minuteseveryday. Or is there a way I can write my script so that it runs
every 5 minutes. Task sheduler on NT looks like it cant help run my script
every 5minutes everyday.

Any help will be appreciated.

Thanks
Ackim




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: $_ question

2001-07-28 Thread Jos I. Boumans

nah that's quite alright... teaches me to go to BED rather then try and make
my hands type things my brain can't even grasp anymore ;-)

> On Sat, Jul 28, 2001 at 01:22:06AM +0200, Jos I. Boumans wrote:
>
> Hopefully my corrections below aren't insulting, but I felt it necessary
so
> that people don't come away from this discussion with the wrong notions.
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]