Re: perl qstn...

2010-04-09 Thread Alejandro Imass
On Fri, Apr 9, 2010 at 5:56 AM, Randal L. Schwartz wrote: >> "Alejandro" == Alejandro Imass writes: > > Alejandro> did you mean unless? ;-) > > Did you read this: > >>> Augh.  I hit send just as I realized that's backwards.  Need >>> more caffiene.  Swap the true and false blocks there. :) >

Re: perl qstn...

2010-04-09 Thread Randal L. Schwartz
> "Alejandro" == Alejandro Imass writes: Alejandro> did you mean unless? ;-) Did you read this: >> Augh.  I hit send just as I realized that's backwards.  Need >> more caffiene.  Swap the true and false blocks there. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503

Re: perl qstn...

2010-04-08 Thread RW
On Wed, 7 Apr 2010 19:15:05 -0600 Chad Perrin wrote: > On Wed, Apr 07, 2010 at 01:09:54PM +0100, RW wrote: > > On Tue, 6 Apr 2010 21:07:17 -0600 > > Chad Perrin wrote: > > > > > On Tue, Apr 06, 2010 at 01:20:49PM +0100, RW wrote: > > > > On Mon, 5 Apr 2010 19:55:44 -0600 > > > > Chad Perrin wr

Re: perl qstn...

2010-04-07 Thread Chad Perrin
On Wed, Apr 07, 2010 at 01:09:54PM +0100, RW wrote: > On Tue, 6 Apr 2010 21:07:17 -0600 > Chad Perrin wrote: > > > On Tue, Apr 06, 2010 at 01:20:49PM +0100, RW wrote: > > > On Mon, 5 Apr 2010 19:55:44 -0600 > > > Chad Perrin wrote: > > > > > > > On Mon, Apr 05, 2010 at 05:36:32PM +0100, RW wrot

Re: perl qstn...

2010-04-07 Thread Alejandro Imass
On Tue, Apr 6, 2010 at 5:10 PM, Randal L. Schwartz wrote: >> "Chuck" == Chuck Swiger writes: > [...] > Now, on the other hand, emacs rules, vi sucks.  :-) :-) you got that right bud! oh, and the Perl stuff too ;-) > > -- > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503

Re: perl qstn...

2010-04-07 Thread Gary Kline
On Tue, Apr 06, 2010 at 09:01:10PM -0600, Chad Perrin wrote: > On Tue, Apr 06, 2010 at 06:17:41PM -0400, Steve Bertrand wrote: > > On 2010.04.06 17:10, Randal L. Schwartz wrote: > > > > > Now, on the other hand, emacs rules, vi sucks. :-) :-) > > > > ok, ok. I was on the side of Perl, and was co

Re: perl qstn...

2010-04-07 Thread RW
On Tue, 6 Apr 2010 21:07:17 -0600 Chad Perrin wrote: > On Tue, Apr 06, 2010 at 01:20:49PM +0100, RW wrote: > > On Mon, 5 Apr 2010 19:55:44 -0600 > > Chad Perrin wrote: > > > > > On Mon, Apr 05, 2010 at 05:36:32PM +0100, RW wrote: > > > There are more things in heav'n and earth, Horatio, than a

Re: perl qstn...

2010-04-06 Thread Chad Perrin
On Tue, Apr 06, 2010 at 01:20:49PM +0100, RW wrote: > On Mon, 5 Apr 2010 19:55:44 -0600 > Chad Perrin wrote: > > > On Mon, Apr 05, 2010 at 05:36:32PM +0100, RW wrote: > > > > > > IMO this is a bad mistake that other languages were quite right not > > > to copy - a test shouldn't come after a blo

Re: perl qstn...

2010-04-06 Thread Chad Perrin
On Tue, Apr 06, 2010 at 06:17:41PM -0400, Steve Bertrand wrote: > On 2010.04.06 17:10, Randal L. Schwartz wrote: > > > Now, on the other hand, emacs rules, vi sucks. :-) :-) > > ok, ok. I was on the side of Perl, and was content following this > thread, but now I don't like you anymore :P > > h

Re: perl qstn...

2010-04-06 Thread Steve Bertrand
On 2010.04.06 17:10, Randal L. Schwartz wrote: > Now, on the other hand, emacs rules, vi sucks. :-) :-) ok, ok. I was on the side of Perl, and was content following this thread, but now I don't like you anymore :P heh ;) Steve ___ freebsd-questions@f

Re: perl qstn...

2010-04-06 Thread Randal L. Schwartz
> "Chuck" == Chuck Swiger writes: Chuck> Very well; I would like to hear you propose another type of Chuck> change that might be made to this sort of postfix test syntax Chuck> which you consider to be "most likely". Maybe the content of the text message. I change that stuff all the time.

Re: perl qstn...

2010-04-06 Thread Chuck Swiger
On Apr 6, 2010, at 11:43 AM, Randal L. Schwartz wrote: > "Chuck" == Chuck Swiger writes: >> Then you wouldn't have used this construct. > > Chuck> If the construct isn't a good idea considering the most obvious > Chuck> change one might make to the code, > > Objection: presumes facts not in evi

Re: perl qstn...

2010-04-06 Thread Randal L. Schwartz
> "Chuck" == Chuck Swiger writes: >> >> Then you wouldn't have used this construct. Chuck> If the construct isn't a good idea considering the most obvious Chuck> change one might make to the code, Objection: presumes facts not in evidence, your honor. Seriously, I've written thousands of

Re: perl qstn...

2010-04-06 Thread Chuck Swiger
On Apr 6, 2010, at 11:07 AM, Randal L. Schwartz wrote: >> "Chuck" == Chuck Swiger writes: > Chuck> Let's suppose you want to display one message if debugging is > Chuck> enabled, and a shorter message if it is not. > > Then you wouldn't have used this construct. If the construct isn't a good ide

Re: perl qstn...

2010-04-06 Thread Randal L. Schwartz
> "Chuck" == Chuck Swiger writes: Chuck> Let's suppose you want to display one message if debugging is Chuck> enabled, and a shorter message if it is not. Then you wouldn't have used this construct. >> If you don't like all this freedom, there's always Python. :) Chuck> Yes, Perl lets you

Re: perl qstn...

2010-04-06 Thread Chuck Swiger
Hi-- On Apr 6, 2010, at 6:21 AM, Randal L. Schwartz wrote: >> "RW" == RW writes: > RW> Imperative languages have a natural order of decision followed by > RW> action, and code is most easily readable if the syntax doesn't try to > RW> subvert that. > > And yet, there's an equally valid ar

Re: perl qstn...

2010-04-06 Thread Randal L. Schwartz
> "Giorgos" == Giorgos Keramidas writes: Giorgos> This means you can write your sh version like this in Perl: Giorgos> #!/usr/bin/perl Giorgos> if (int(@ARGV) == 0) { Giorgos> die "No args; at least one filename expected"; Giorgos> } Giorgos> printf("%s\n", join(' ',

Re: perl qstn...

2010-04-06 Thread Giorgos Keramidas
On Sun, 04 Apr 2010 02:01:53 -0700, Gary Kline wrote: > thanks for your url as well and the others to posted. but it seems > like overkill since i dont need any explicit option or argument. i > just need the script to tell me whether i have an arg or not. > following is something i've kept in on

Re: perl qstn...

2010-04-06 Thread Randal L. Schwartz
> "RW" == RW writes: RW> Imperative languages have a natural order of decision followed by RW> action, and code is most easily readable if the syntax doesn't try to RW> subvert that. And yet, there's an equally valid argument that the most important thing should stand out the most. In th

Re: perl qstn...

2010-04-06 Thread RW
On Mon, 5 Apr 2010 19:55:44 -0600 Chad Perrin wrote: > On Mon, Apr 05, 2010 at 05:36:32PM +0100, RW wrote: > > > > IMO this is a bad mistake that other languages were quite right not > > to copy - a test shouldn't come after a block of code unless it's > > evaluated after the block (as in repeat

Re: perl qstn...

2010-04-05 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/04/2010 02:55:44, Chad Perrin wrote: > 3. lazy evaluation, where the (result) is not evaluated until it is > needed, which gives the interpreter plenty of time to notice there's > an "unless" immediately following it > > Obviously, t

Re: perl qstn...

2010-04-05 Thread Chad Perrin
On Mon, Apr 05, 2010 at 05:36:32PM +0100, RW wrote: > > IMO this is a bad mistake that other languages were quite right not to > copy - a test shouldn't come after a block of code unless it's evaluated > after the block (as in repeat...until) There are more things in heav'n and earth, Horatio, t

Re: perl qstn...

2010-04-05 Thread RW
On Mon, 05 Apr 2010 09:57:17 +0100 Matthew Seaman wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I've always found that 'unless' makes a great deal of sense when used > in the alternate syntax: > > do_foo() > unless $condition ; > > As far as I know, perl and its descendant

Re: perl qstn...

2010-04-05 Thread parv
in message <867homm1qf@red.stonehenge.com>, wrote Randal L. Schwartz thusly... > > > "Matthew" == Matthew Seaman > > writes: > > Matthew> As far as I know, perl and its descendant ruby are the > Matthew> only programming languages that let you put the > Matthew> condition test after th

Re: perl qstn...

2010-04-05 Thread Randal L. Schwartz
> "Matthew" == Matthew Seaman writes: Matthew> As far as I know, perl and its descendant ruby are the only Matthew> programming languages that let you put the condition test after Matthew> the action, despite this being exceeding familiar in human Matthew> languages. Except, we old-timers re

Re: perl qstn...

2010-04-05 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/04/2010 19:48:14, Alejandro Imass wrote: > But honestly pun aside unless(){} is far more readable than if(!){} > and _especially_ if you are programming in an exception manner as you > correctly point out. Every language should have an unless con

Re: perl qstn...

2010-04-04 Thread Gary Kline
gt; FreeBSD Mailing List > > Cc: > > Subject: Re: perl qstn... > > > > On Sun, Apr 04, 2010 at 10:58:35AM -1000, p...@pair.com wrote: > > > in message <20100404203951.gb47...@thought.org>, > > > wrote Gary Kline thusly... > > > > > >

Re: Caution:: Off-topic Re: perl qstn...

2010-04-04 Thread Chad Perrin
On Sun, Apr 04, 2010 at 02:33:02PM -0700, Gary Kline wrote: > > anybody know if we need a new C [[maybe D]] that would be > allowed to grow? There's already a D. I don't really know much about it, though. -- Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] p

Re: perl qstn...

2010-04-04 Thread Robert Bonomi
> From owner-freebsd-questi...@freebsd.org Sun Apr 4 17:14:17 2010 > Date: Sun, 4 Apr 2010 15:13:49 -0700 > From: Gary Kline > To: "Randal L. Schwartz" , glar...@freebsd.org, > FreeBSD Mailing List > Cc: > Subject: Re: perl qstn... > > On Sun

Re: Caution:: Off-topic Re: perl qstn...

2010-04-04 Thread C. P. Ghost
On Sun, Apr 4, 2010 at 11:33 PM, Gary Kline wrote: > Can C include the perl regex packages? Yes! Just use PCRE. Or, if you prefer C++, Boost.Regex: http://www.pcre.org/ http://www.boost.org/doc/libs/1_42_0/libs/regex/doc/html/index.html -- Cordula's Web. http://www.cordula.ws/

Re: perl qstn...

2010-04-04 Thread Gary Kline
On Sun, Apr 04, 2010 at 10:58:35AM -1000, p...@pair.com wrote: > in message <20100404203951.gb47...@thought.org>, > wrote Gary Kline thusly... > > > > ---Maybe you can clue me in on this one: around a dozen years ago > > i somw found a recursive grep named tgrep online. to save tying, > > i rena

Caution:: Off-topic Re: perl qstn...

2010-04-04 Thread Gary Kline
On Sun, Apr 04, 2010 at 12:45:30PM -0400, Alejandro Imass wrote: > On Sun, Apr 4, 2010 at 11:27 AM, Randal L. Schwartz > wrote: > >> "Randal" == Randal L Schwartz writes: > > > > Randal> Even simpler: > > > > Randal>     if (@ARGV) { > did you mean unless? ;-) > > Randal>       print "No args

Re: perl qstn...

2010-04-04 Thread parv
in message <20100404203951.gb47...@thought.org>, wrote Gary Kline thusly... > > ---Maybe you can clue me in on this one: around a dozen years ago > i somw found a recursive grep named tgrep online. to save tying, > i renamed it "rgr". i can start anywhere and 'rgr pattern' > --WITHOUT ANY ASTER

Re: perl qstn...

2010-04-04 Thread Gary Kline
On Sun, Apr 04, 2010 at 08:25:03AM -0700, Randal L. Schwartz wrote: > > "Gary" == Gary Kline writes: > > Gary> #!/usr/bin/perl > Gary> $argc = @ARGV; > Gary> if (! $argc ) { > Gary> printf("No args; need filename.\n"); > Gary> } > Gary> else { > Gary> printf("%s\n", @ARGV); >

Re: perl qstn...

2010-04-04 Thread Alejandro Imass
On Sun, Apr 4, 2010 at 11:25 AM, Randal L. Schwartz wrote: >> "Gary" == Gary Kline writes: [...] > And I'd recommend a couple of good books, but I might be seen as > self-pimping. :) > > But if you look at http://learn.perl.org/ you'll see a number of other > resources, including free tutori

Re: perl qstn...

2010-04-04 Thread Alejandro Imass
On Sun, Apr 4, 2010 at 2:14 PM, Polytropon wrote: > On Sun, 4 Apr 2010 10:33:53 -0600, Chad Perrin wrote: >> On Sun, Apr 04, 2010 at 12:45:30PM -0400, Alejandro Imass wrote: >> > did you mean unless? ;-) >> >> I find "if" to be clearer than "unless" when there's an "else", so >> instead of making

Re: perl qstn...

2010-04-04 Thread Polytropon
On Sun, 4 Apr 2010 10:33:53 -0600, Chad Perrin wrote: > On Sun, Apr 04, 2010 at 12:45:30PM -0400, Alejandro Imass wrote: > > did you mean unless? ;-) > > I find "if" to be clearer than "unless" when there's an "else", so > instead of making that "if" into an "unless", I'd just swap the > conditio

Re: perl qstn...

2010-04-04 Thread Alejandro Imass
On Sun, Apr 4, 2010 at 11:04 AM, Chad Perrin wrote: > On Sun, Apr 04, 2010 at 08:25:03AM -0700, Randal L. Schwartz wrote: [...] > The final member of the traditional camelid trilogy, and a great book to Hmm, so there _are_ in fact several trilogies! I would swap the Camel for the Black Leopard

Re: perl qstn...

2010-04-04 Thread Chad Perrin
On Sun, Apr 04, 2010 at 12:45:30PM -0400, Alejandro Imass wrote: > On Sun, Apr 4, 2010 at 11:27 AM, Randal L. Schwartz > wrote: > >> "Randal" == Randal L Schwartz writes: > > > > Randal> Even simpler: > > > > Randal>     if (@ARGV) { > did you mean unless? ;-) I find "if" to be clearer than

Re: perl qstn...

2010-04-04 Thread Alejandro Imass
On Sun, Apr 4, 2010 at 11:27 AM, Randal L. Schwartz wrote: >> "Randal" == Randal L Schwartz writes: > > Randal> Even simpler: > > Randal>     if (@ARGV) { did you mean unless? ;-) > Randal>       print "No args\n"; > Randal>     } else { > Randal>       print "arg is $ARGV[0]\n"; > Randal>  

Re: perl qstn...

2010-04-04 Thread Chad Perrin
On Sun, Apr 04, 2010 at 08:25:03AM -0700, Randal L. Schwartz wrote: > > Even simpler: > > if (@ARGV) { > print "No args\n"; > } else { > print "arg is $ARGV[0]\n"; > } As Randal noted, he accidentally swapped the conditions here. Just for the sake of absolute clarity, I'

Re: perl qstn...

2010-04-04 Thread Randal L. Schwartz
> "Randal" == Randal L Schwartz writes: Randal> Even simpler: Randal> if (@ARGV) { Randal> print "No args\n"; Randal> } else { Randal> print "arg is $ARGV[0]\n"; Randal> } Augh. I hit send just as I realized that's backwards. Need more caffiene. Swap the true and

Re: perl qstn...

2010-04-04 Thread Randal L. Schwartz
> "Gary" == Gary Kline writes: Gary> #!/usr/bin/perl Gary> $argc = @ARGV; Gary> if (! $argc ) { Gary> printf("No args; need filename.\n"); Gary> } Gary> else { Gary> printf("%s\n", @ARGV); Gary> } Even simpler: if (@ARGV) { print "No args\n"; } else { pri

Re: perl qstn...

2010-04-04 Thread Gary Kline
On Sun, 2010-04-04 at 00:07 -0400, Greg Larkin wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Gary Kline wrote: > > guys, > > > > i'm finally trying to get my private scripts and binaries in > > ~/bin in order. several of my perl scripts were meant to be > > throwaway ... but a fe

Re: perl qstn...

2010-04-03 Thread Greg Larkin
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gary Kline wrote: > guys, > > i'm finally trying to get my private scripts and binaries in > ~/bin in order. several of my perl scripts were meant to be > throwaway ... but a few seem to be more useful and i would have > to have informational or usa

Re: perl qstn...

2010-04-03 Thread Chad Perrin
On Sat, Apr 03, 2010 at 02:17:06PM -0700, Randal L. Schwartz wrote: > > "Gary" == Gary Kline writes: > > Gary> if a .pl script has to have at least one arg, is there an easy > Gary> way to do that? > > Dare I say, "there's more than one way to do it?" :) > > See the "Getopt::" family in the

Re: perl qstn...

2010-04-03 Thread Randal L. Schwartz
> "Gary" == Gary Kline writes: Gary> if a .pl script has to have at least one arg, is there an easy Gary> way to do that? Dare I say, "there's more than one way to do it?" :) See the "Getopt::" family in the CPAN. My favorite is Getopt::Long. -- Randal L. Schwartz - Stonehenge Consulting

perl qstn...

2010-04-03 Thread Gary Kline
guys, i'm finally trying to get my private scripts and binaries in ~/bin in order. several of my perl scripts were meant to be throwaway ... but a few seem to be more useful and i would have to have informational or usage{} type messages. if a .pl script has to have at least one arg, is ther