[25966] in Perl-Users-Digest
Perl-Users Digest, Issue: 8185 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 18 18:05:31 2005
Date: Sat, 18 Jun 2005 15:05:05 -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 Sat, 18 Jun 2005 Volume: 10 Number: 8185
Today's topics:
Re: Algorithm: spreading out jobs/events in time (Anno Siegel)
how to count route differences in traceroute outputs? <clint@freemail.hu>
Re: how to count route differences in traceroute output <john@castleamber.com>
Re: how to count route differences in traceroute output <1usa@llenroc.ude.invalid>
Re: Regex with a varrying number of captures <someone@example.com>
Re: Regex with a varrying number of captures <jurgenex@hotmail.com>
Taking a string from body text and putting into a varia <slake2@ns.sympatico.ca>
Re: Taking a string from body text and putting into a v <john@castleamber.com>
Re: Taking a string from body text and putting into a v <sherm@dot-app.org>
Re: Taking a string from body text and putting into a v <tadmc@augustmail.com>
Re: Taking a string from body text and putting into a v <john@castleamber.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Jun 2005 21:02:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Algorithm: spreading out jobs/events in time
Message-Id: <d9224j$pg3$1@mamenchi.zrz.TU-Berlin.DE>
pkent <pkent77tea@yahoo.com.tea> wrote in comp.lang.perl.misc:
[...]
> Visual example:
>
> E.g. imagine 2 jobs that run every 4 minutes, and one that runs every 8.
> One way of spreading them out would be this (each number is a different
> job:
>
> 1...1...1...1...1...1...1...1...
> ..2...2...2...2...2...2...2...2.
> ...3.......3.......3.......3...
>
> as opposed to
>
> 1...1...1...1...1...
> 2...2...2...2...2...
> 3.......3.......3...
>
> I've been thinking about frequencies, harmonics, phases, highest common
> factors, subsets of jobs with the highest common factor, differentials,
> local minima, ... but is this soluble?
It should be solvable, once you provide another crucial parameter: how
long each job takes. In your image of frequencies, you can't say anything
about the overlap in a set of pulse trains when you know know only the
frequency but not the duration (or duty cycle) of each train.
The solution won't be trivial to find, and I'm not convinced it is
worth trying. Start the jobs when you want them to run and let the
OS sort it out.
Anno
------------------------------
Date: Sat, 18 Jun 2005 18:48:11 +0200
From: clint <clint@freemail.hu>
Subject: how to count route differences in traceroute outputs?
Message-Id: <pan.2005.06.18.16.48.10.538679@freemail.hu>
hi
please help me!
i need to count changes of IP addresses and hostnames
of the route to a given remote host.
many thanx for any help!
clint
------------------------------
Date: 18 Jun 2005 17:14:36 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: how to count route differences in traceroute outputs?
Message-Id: <Xns96797C8B5E667castleamber@130.133.1.4>
clint wrote:
> hi
>
> please help me!
> i need to count changes of IP addresses and hostnames
> of the route to a given remote host.
> many thanx for any help!
What have you tried so far? (Sounds like: nothing, please make it for me,
now!!)
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Sat, 18 Jun 2005 17:23:21 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: how to count route differences in traceroute outputs?
Message-Id: <Xns9679882E1C827asu1cornelledu@127.0.0.1>
clint <clint@freemail.hu> wrote in news:pan.2005.06.18.16.48.10.538679
@freemail.hu:
> please help me!
Please read the posting guidelines for this group. They contain valuable
information on how you can help yourself, and how you can help others help
you.
> i need to count changes of IP addresses and hostnames
> of the route to a given remote host.
CPAN is your friend:
<URL:http://search.cpan.org/~hag/Net-Traceroute-1.08/Traceroute.pm>
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sat, 18 Jun 2005 11:03:01 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Regex with a varrying number of captures
Message-Id: <FbTse.78802$tt5.35905@edtnps90>
Jürgen Exner wrote:
> Joe Gottman wrote:
>
>>I am parsing a file with several lines of the form
>> keyword : value1 value2 ... valueN
>>
>>What is the easiest way for me to write a regex that will capture all
>>of the values?
>
> Well, why do you want to use a regexp? A simple
> my ($keyword, undef, @values) = split / /,$line;
> should do the job much easier and faster.
That *does* use a regexp. :-)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sat, 18 Jun 2005 13:50:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Regex with a varrying number of captures
Message-Id: <%EVse.19084$lb5.18995@trnddc04>
John W. Krahn wrote:
> Jürgen Exner wrote:
>> Joe Gottman wrote:
>>
>>> I am parsing a file with several lines of the form
>>> keyword : value1 value2 ... valueN
>>>
>>> What is the easiest way for me to write a regex that will capture
>>> all of the values?
>>
>> Well, why do you want to use a regexp? A simple
>> my ($keyword, undef, @values) = split / /,$line;
>> should do the job much easier and faster.
>
> That *does* use a regexp. :-)
Hmmm, guilty as charged ;-)
But at least not for capturing the desired values.
jue
------------------------------
Date: Sat, 18 Jun 2005 19:25:32 GMT
From: "Stephen Lake" <slake2@ns.sympatico.ca>
Subject: Taking a string from body text and putting into a variable
Message-Id: <My_se.49041$Ph4.1303876@ursa-nb00s0.nbnet.nb.ca>
Ok,
I have searched the documentation high and low and reread sections
repeatedly and cannot find any function or code example to take a string
from a body of text and use that one string and populate a variable with
that single string.
I use a simple regexp to match the string if it exists in the body just
fine.....but how do I take that string and put it into its own variable and
strip it out of the body text in perl?
here is an example of what I want to learn to do:
BODY TEXT:
hello I am a cat now I am a dog now I am cow now I am a car now I am a house
now I am a office now I am a shoe
STRING TO PUT INTO THE VARIABLE $x AND STRIP FROM BODY TEXT:
I am a house
Any help here would be very much appreciated. Thanx
Steve
------------------------------
Date: 18 Jun 2005 19:45:15 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Taking a string from body text and putting into a variable
Message-Id: <Xns967996151D5E8castleamber@130.133.1.4>
"Stephen Lake" <slake2@ns.sympatico.ca> wrote:
> Ok,
> I have searched the documentation high and low and reread sections
> repeatedly and cannot find any function or code example to take a
> string from a body of text and use that one string and populate a
> variable with that single string.
>
> I use a simple regexp to match the string if it exists in the body
> just fine.....but how do I take that string and put it into its own
> variable and strip it out of the body text in perl?
You didn't read the documentation did you? Keyword: capture.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Sat, 18 Jun 2005 14:50:13 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: Taking a string from body text and putting into a variable
Message-Id: <87is0b7b4q.fsf@dot-app.org>
"Stephen Lake" <slake2@ns.sympatico.ca> writes:
> I use a simple regexp to match the string if it exists in the body just
> fine.....but how do I take that string and put it into its own variable and
> strip it out of the body text in perl?
Have a look at "perldoc perlretut" - especially the section titled "Extracting
matches".
sherm--
------------------------------
Date: Sat, 18 Jun 2005 14:59:19 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Taking a string from body text and putting into a variable
Message-Id: <slrndb8v8n.63g.tadmc@magna.augustmail.com>
Stephen Lake <slake2@ns.sympatico.ca> wrote:
> Ok,
> I have searched the documentation high and low and reread sections
> repeatedly and cannot find any function or code example to take a string
> from a body of text and use that one string and populate a variable with
> that single string.
my $single_string = substr $big_string, 10, 20;
> I use a simple regexp to match the string if it exists in the body just
> fine.....but how do I take that string and put it into its own variable and
if ( $big_string =~ /(PATTERN)/ ) # m// in scalar context
{ $single_string = $1 }
or
my($single_string =) $big_string =~ /(PATTERN)/; # m// in list context
> strip it out of the body text in perl?
Use s/// instead of m// in a scalar context.
> here is an example of what I want to learn to do:
>
> BODY TEXT:
> hello I am a cat now I am a dog now I am cow now I am a car now I am a house
> now I am a office now I am a shoe
>
> STRING TO PUT INTO THE VARIABLE $x AND STRIP FROM BODY TEXT:
> I am a house
>
> Any help here would be very much appreciated. Thanx
my $big_string = ' hello I am a cat now I am a dog now I am cow '
. 'now I am a car now I am a house '
. 'now I am a office now I am a shoe';
my $single_string;
if ( $big_string =~ s/(house)// )
{ $single_string = $1 }
print "'$single_string'\n";
print "$big_string\n";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 18 Jun 2005 20:31:24 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Taking a string from body text and putting into a variable
Message-Id: <Xns96799DE631405castleamber@130.133.1.4>
Tad McClellan <tadmc@augustmail.com> wrote:
> my($single_string =) $big_string =~ /(PATTERN)/;
^ oops?
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
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 V10 Issue 8185
***************************************