On Thu, Feb 25, 2016 at 4:14 PM, Uri Guttman wrote:
> how about scheduling some meetings on a different day of the week? [...]
> why not rotate between mon-wed each month or something similar?
I second Uri's suggestion.
peace,
-- Kripa
Folks,
I need help to reset my brain, w.r.t. an apparently-straightforward regex.
I am sure I am missing something obvious here.
I keep thinking that the regex below ought to get me all the words on a line
except the backslash. Instead I am only getting the final word.
(In my code, I threw out
Thanks to all who replied so promptly.
Duane's explanation captured it best for me.
From: Duane Bronson
Subject: Re: [Boston.pm] Perl regex question
Date: Thu, Oct 25, 2012 at 06:31:01PM -0400
m// returns an array of ($1,$2,$3...), but your word (\w\S*) is always $1
even though it's hit
Hi folks,
Problem:
I have a 900 Meg text file, containing random text. I also have a list
of 6000 names (alphanumeric strings) that occur in the random text.
I need to tag a prefix on to each occurrence of each of these 6000
names.
My premise:
I believe a regex would give the simplest and most
Hi all,
From: Jerrad Pierce
If funding would help someone devote time to proposal logisitics, I'd like to
reiterate a previous proposal: that people chip in a few bucks to that end.
[...]
I'll be glad to contribute money to facilitate anyone's efforts
towards bringing YAPC to Boston.
Hi all,
Does anyone know whether the Harvard (3/31) and MIT (4/1) talks on the
same topic, or two different talks?
peace, || Basketball star with fifteen-dollar shoes:
--{kr.pA} || http://www.dailygood.org/more.php?n=2543
--
Warning: gratuitous use of gratuitous in current
Dear Ronald and Uri,
Thanks for your prompt replies.
After reading your replies, I realised that Uri's summary
(that named unary operators are of higher precedence than ? :) is
echoed by the Named Unary Operators section of perldoc perlop.
Thanks for the -MO=Deparse,-p example, Ronald.
Hi all,
Is this a glob() bug, or am I overlooking something obvious?
perldoc -f glob didn't help. TIA.
The .[0-9]*[0-9] is globbed correctly when it is not
inside braces.
% touch a ab abcd a.777
%
% perl -le \
'print for glob(a{,b,b*d,.[0-9]*[0-9]}), ---, glob(a.[0-9]*[0-9])'
a
ab
It looks to me like a bug.
Thanks for confirming my experience, Ben. I was getting tired of
re-reading and re-typing my command lines to rule out stupid typo's.
Incidentally, perl v5.8.3 shows the same buggy behaviour on
solaris as well as linux.
peace, || Ben Cohen tells us
http://perladvent.pm.org and http://advent.pm.org are available,
http://www.perladvent.org still is not.
Thanks for the prompt fix, Jerrad!
peace, || Akanksha: Not your average after-school program:
--{kr.pA} || http://tinyurl.com/49ghs
--
If it's theoretically
Dear Ben,
Thanks for the detailed reply to my query.
If my questions below can be answered by online docs, please feel free
to point me to them. I read through the following docs before my
previous email. But I am still mostly in the dark:
* man -s 2 for fork(), wait(), waitpid() and kill()
*
Hello all,
I thought this was fairly simple (and it probably is). But I am not
able to figure out how I can fork() off, say, five child processes, and
wait for all of them to terminate.
Is the code below on the right track? Is it as simple as
wait for [EMAIL PROTECTED]? I think this will let
While talking to my son he pointed out that tailing xferlog would be a
problem when the log is being rotated. [...]
Wow, so child processes can communicate useful information back
to parent processes after all! :-)
peace, || No Coke at University of Michigan:
--{kr.pA}
Dear Ranga,
I tried grep and egrep - they seem to match only one line at a time. I am
unable to match for \n inside the pattern.
What shell utility would do it? I dont want to bring in the perl
interpreter just for this!
Please *do*!
If the perl invocation is your performance
Dear Ranga,
Two clarifications on my previous email.
I wrote:
If the perl invocation is your performance bottleneck, that is a
pleasant problem to deal with.
What I meant to write is this:
If the overhead of invoking perl is your performance bottleneck, that is a
pleasant problem to deal
Dear Steve,
Also date and time are combined into three fields, but the third is
either time or year. This makes it harder to process. I would actually
prefer time in seconds since the start of the Unix eon.
IMHO, File::Find and stat() should solve your problems.
The following is a starting
Dear Uri and others,
I spoke to lesley.edu . Their largest theatre has 189 seats only.
The lady who helped me could not offer any other suggestions.
So I guess Lesley is out.
To make further enquiries, we (those of us who are volunteers/followers)
need to know the following information at
Dear Uri,
so an easy thing to do is to search the local college sites for similar
pages and see what is out there. then call someone and get some more
info. this is something anyone (even kripa! :) can do. in fact can
someone call the lesley contact on that page and see if they have larger
Dear Ben, Tim and others,
I've been learning a lot from this entire thread. Thanks to all the
responders.
Tim writes:
[...] [W]e can indeed add another item to Kripa's list:
* context confusion
eval() executes in the context in which it's called, not the
context in which the
i just want to reiterate my view on string eval (and symrefs). they are
powerful tools that are needed to solve a certain class of
problems. they rarely are the best solution [...]
so my rule again (and kripa, tell your cow-orker this one) is:
you should not use string eval (or symrefs)
Dear Uri,
Thanks to you and the others for your prompt responses.
another bad point about eval is that it can access and modify lexicals
and globals anywhere in the code. so that can lead to action at a
distance and very hard to find bugs.
I don't quite follow.
Globals are anyway
Dear Tom,
You seem to be blending the concepts of eval and system.
Sorry about the confusing presentation there. My friend had
actually written something like:
--\/BEGIN-\/--
$string = system(\cat $somefile | mail -s \\\$something\\\
Which of course should really be written as:
system(mail -s '$something' '$audience' $somefile);
Yes, of course. It is one of the classic useless uses of cat(1).
I had meant to write this also to my friend, but forgot in my
indignation over six backslashes. :-)
peace,
Dear Ben,
another bad point about eval is that it can access and modify lexicals
and globals anywhere in the code. so that can lead to action at a
distance and very hard to find bugs.
[...]
I'm not sure if this is what is referred to, but it applies.
If this is dynamic code where
Dear Uri,
[...] subs can come into existance any time and be
handled by AUTOLOAD and such. so there is no easy compile time way to
check that at the moment. [...]
A sub can, of course, be defined at run-time and then used. But this
is not the point.
It is the same principle as for any other
Dear Chris,
$xml =~ s/chr(145)/'/g;
$xml =~ s/chr(146)/'/g;
$xml =~ s/chr(147)//g;
$xml =~ s/chr(148)//g;
Would this work for you?
--\/BEGIN-\/--
warn WARNING: UNTESTED CODE;
my %map = (
chr(145) = q.'.,
chr(146) = q.'.,
Dear Nilanjan,
Yup!
Thanks,
Thanks to Larry and friends for inventing non-greedy quantification. :-)
peace, || Udayachal: a newspaper edited by slum children:
--{kr.pA}|| http://tinyurl.com/57jaf
--
This .sig intentionally left blank.
Dear Nilanjan,
If I used a RE like the following:
$dir =~ m,^(.*)/($fruits)/,;
I get a greedy match, upto including the last occurrence. Is there a
RE to get the path up to the first occurrence of any one of the
alternatives?
Doesn't non-greedy quantification solve your problem?
$dir
Hello all,
I had asked:
Command 5:
Why is - bogus not treated as a unary minus operation on a
bareword? Why does it get stringified and squeezed into
-bogus? (See Command 7.)
perldoc perlop says that this is the intended behaviour:
|| Unary - performs arithmetic negation if the operand
Hi all,
An unnamed White House source today stated that regexes are
beginning to infiltrate the RHS of substitutions, and thus
threaten our national security.
This was corroborated by the following sighting:
s/Perl/(Bike Riding|Gardening|Cooking|Painting|Teaching|Filmmaking)/;
:-) :-) for the
s/Perl/(Bike Riding|Gardening|Cooking|Painting|Teaching|Filmmaking)/;
Oddly enough, the the syntactically correct code does not quite have the same
meaning or elegance. ...
\begin{nitpick}
The s/// is already syntactically correct. :-)
\end{nitpick}
... Note that I modified the list
Then use chown():
chown LIST
Changes the owner (and group) of a list of files. [...]
Thanks, Brian and Ron. That was fast!
peace, || Uttaranchal: Electricity from 7th century water mills:
--{kr.pA} || http://tinyurl.com/yufep
--
What difference does
Dear Gyepi,
As it turns out, I have also implemented 'atomic'
operations on groups of files solely in perl. In this case,
each undoable action stores an undo coderef in a global
array after the 'do' action has completed. [...]
I'd love to learn more.
Of course, but I assume we are all
Dear Gyepi,
#!/bin/sh
type=$1
if [ $type eq do ]; then
groupadd bar
useradd foo ...
gpasswd -a foo bar
...
elif [ $type eq undo ]; then
userdel foo
groupdel bar
...
fi
Thanks for the example. This is certainly an interesting
technique. But
Dear Uri,
from perlop:
A (file)glob evaluates its (embedded) argument only when it
is starting a new list. All values must be read before it
will start over. [...]
i call that documented :)
I am forced to agree. :-)
KS If I want to grok ~someone/some/stuff, glob()
20: warn blah blah\n if (glob(~$arg) !~ m{^ (/\w+)+ /$arg $}x);
globIn list context, returns a (possibly empty) list of filename
expansions on the value of EXPR such as the standard Unix shell
/bin/csh would do. In scalar context, glob iterates
Anyway, you should probably be using getpwnam() rather than glob() to check
for valid usernames.
Thanks, Ronald. I'll do that.
(But the glob bug is still a bug, IMHO.)
peace, || Operation Shoe Fly: Send your shoes to Afghan children:
--{kr.pA} || http://tinyurl.com/6jnpf
--
Dear Chris,
The word I have written here is [...] masculine, and
ends in s. Not only that, but you change this word from plural to
singular and from masculine to feminine, all by adding an s to it!
[...]
If the word in question is in /usr/share/dict/words, then it should be
one
Dear Chris,
I wrote:
|| % perl -wMstrict -lne 'use vars qq.%x.; (my $y = $_) =~ s/ss$/s/; \
|| print if $x{$y}; $x{$_}++;' /usr/dict/words
|| ass
|| buss
|| canvass
|| discuss
|| Douglass
|| hiss
|| %
[...]
The Lingua::EN::Inflect approach would obviously not
As this doc excerpt (from map on perlfunc) says it should:
{ starts both hash references and blocks, so map { ...
could be either the start of map BLOCK LIST or map EXPR, LIST.
Because perl doesn't look ahead for the closing } it has to
Hello all,
I am clearly overlooking something basic, but I can't wrap my
head around the parse error in the second command below.
It is apparently caused when the the only contents of a map()
BLOCK is a list without parens.
|| % perl -le 'print map {1; 1, 2} qw(a b)'
|| 1212
|| %
|| %
... send your RSVPs now, so we can arrange for a
larger room if necessary.
Yes. I'll plan on bringing my laptop.
How big of a laptop is it? [...]
:-)
Proportional to the size of the lap, I imagine.
peace, || Avoiding dimpled chads in Rajasthan:
--{kr.pA}
KAG Pay no attention to the man hiding behind the laptop.
why are you going to bring it anyway? damian uses his own ibook.
I see you are paying no attention, as advised. :-)
He needs it to hide behind. :-)
peace, || Avoiding dimpled chads in Rajasthan:
--{kr.pA}
Dear Bill,
Or, my favorite,
chop while /\s$/; ### Omit all trailing whitespace,
### including whole blank lines at the end
### and last CRLF or NL or whatever is holy
IMHO s/\s*$// is faster for the author's brain, the
Dear Mike,
To use a variable means to have it on the RHS, usually. LHS only counts
as defining it.
In computer science, yes. In perl (surprise!) no.
--\/BEGIN-\/--
% perl -lwe '$x = hi;'
Name main::x used only once: possible typo at -e
Dear Chris,
If you define a variable use it only once, the compiler will complain.
No, it won't. At least not the perl compiler.
For perl, an assignment (== definition) is also a use.
=begin repeated_example
--\/BEGIN-\/--
% perl -lwe
Hello all,
Ronald writes:
= Boston.pm will have a tech meeting on Tuesday, April 27, at Boston
= University, Kenmore Classroom Building, 565 Commonwealth Ave, room 106
= (directions below). [...]
= Directions, courtesy of Sean:
= [...]
= If you're taking the T, exit on the same side as the
Thanks, Kenneth and Sean.
peace, || House calls: hope in Koinpur, Orissa:
--{kr.pA} || http://tinyurl.com/x8l3
--
Quiquid latine dictum sit altum viditur.
___
Boston-pm mailing list
[EMAIL PROTECTED]
Ronald writes:
= As you say, it is hard to detect infinite loops. :)
No, it is straightforward to detect *any* infinite loop.
But it does take infinite time to detect it. ;-)
peace, || Project Why in Delhi's Giri Nagar slums:
--{kr.pA} ||
Dear Steve,
= One clarification. The suggested workaround was not to just
= start the regex with a ^ but to start it with ^.*
Longest left-most match means that anchoring with ^.*
will replace the *last* occurrence of the LHS, instead of the
first occurrence.
In addition, the .* in the s/// is
Hi all,
I emailed Dan Sugalski about bringing YAPC to Boston.
Here is part of his reply:
= [...] Now that the perl foundation's finally
= gotten itself sorted out we should be in a position to take
= applications for next year's YAPC and make decisions soon. Pop a note
= to the boston.pm
51 matches
Mail list logo