AW: Building a fmt line for printf with a carriage return

2009-10-26 Thread Thomas Bätzler
Hi, Wagner, David --- Senior Programmer Analyst --- CFS wrote: > Here is the sample script I was playing with: > #!/usr/bin/perl > > use strict; > use warnings; > > my $MyLine1 = q[%2d %5s %6s]; > my $MyLine2 = q[%2d %5s \n%6s]; The q// operator is equivalent to single quotes, so esc

perl document

2009-10-26 Thread mahesh bhasme
Hi, I am new to perl. From where I get the basic perl document -- Thanks, MAhesh

AW: perl document

2009-10-26 Thread Thomas Bätzler
mahesh bhasme asked: > I am new to perl. From where I get the basic perl document Depends on your distribution, really. If you're on Windows and using the ActiveState Perl distribution, look for the html folder in your Perl installation directory. On Unix, you might want to try perldoc or man

Re: perl document

2009-10-26 Thread Shawn H Corey
mahesh bhasme wrote: > Hi, > I am new to perl. From where I get the basic perl document > http://perldoc.perl.org/ -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where

Re: AW: perl document

2009-10-26 Thread Shlomi Fish
On Monday 26 Oct 2009 10:05:05 Thomas Bätzler wrote: > mahesh bhasme asked: > > I am new to perl. From where I get the basic perl document > > Depends on your distribution, really. If you're on Windows and using the > ActiveState Perl distribution, look for the html folder in your Perl > instal

Re: split n characters into n chunks

2009-10-26 Thread Dr.Ruud
Shawn H Corey wrote: John W. Krahn wrote: $ perl -le' my $word = "thequickbrown"; my $subsets = 3; print for $word =~ /(?=(.{$subsets}))/g; Getting up there but substr is still the fastest. I had to set the iterations to 300_000, to get rid of warnings. $ perl5.8.8 3.pl Rate

Re: compact my wordlist generator

2009-10-26 Thread Michael Alipio
hi, I have this code, mentioned below: my @word = qw(a b c ); my $length = @word; my $char1, $char2, $char3; if ($length == 3){ for ($char1 = 0; $char1<$len;$char1++){ for ($char2 = 0; $char2<$len;$char2++){ for ($char3 = 0; $char3<$len;$char3++){ print "$word[$char1]$word[$char2]$word[$c

Re: split n characters into n chunks

2009-10-26 Thread Dr.Ruud
Shawn H Corey wrote: push @list, (unpack( "A${i}A$size", $word ))[1]; Be careful with unpack "A", because it rtrims. Best use "x" to skip, and "a" to capture. push @list, unpack "x${_}a$size", $word for 0 .. $max; Funnily enough, that is somehow&what faster than push @list, map

Re: A Revised Logo for Perl

2009-10-26 Thread Rafal Czlonka
Shawn H Corey wrote: > Perl 6 has a different logo, a cute little butterfly, awww... > http://perl6.org/ Which (AFAICR) is non-negotiable and in textual mode looks like this: »ö« :^) -- Raf http://www.catb.org/~esr/faqs/smart-questions.html -- To unsubscribe, e-mail: beginners-unsub

AW: compact my wordlist generator

2009-10-26 Thread Thomas Bätzler
Michael Alipio wrote: > Can anyone tell me how the code above works? My original program must > deal with arbitrary length and generate all the possible combinations > (even repeating) of a particular set. What could take me gazillions of > for loops for that, somebody just came up with less than

Re: split n characters into n chunks

2009-10-26 Thread Shawn H Corey
Dr.Ruud wrote: > Shawn H Corey wrote: > > >> push @list, (unpack( "A${i}A$size", $word ))[1]; > > Be careful with unpack "A", because it rtrims. > > > Best use "x" to skip, and "a" to capture. > > push @list, unpack "x${_}a$size", $word for 0 .. $max; > > > Funnily enough, that is som

Re: A Revised Logo for Perl

2009-10-26 Thread Randal L. Schwartz
> "M" == "M E8 H " writes: M> This is an minor topic. I feel the Camel logo to represent Perl to be M> strange, illogical and slightly ugly.  I presume I do not get the humor.   In that sense, it represents Perl precisely. print "Just another Perl hacker,"; # the original! -- Randal L. Sc

Re: AW: compact my wordlist generator

2009-10-26 Thread Michael Alipio
Thanks for the advice. Forgive me if I sounded like someone who's frustrated, couldn't do his homework asking somebody else for help. When I was learning C programming, I read that learning those difficult algorithms such as bubble sort, quick sort, binary search, is something that only program

printf with currency symbols

2009-10-26 Thread Bryan R Harris
Is there a good way to do printf's with currency symbols? I've tried this: printf "Total: \$%10.2f\n", $total; But it puts the dollar sign way out front (ugly). I want it to look like: Total:$24.15 Is there a way to do this without getting all messy like this? printf "Total:%10s\

Re: printf with currency symbols

2009-10-26 Thread Jim Gibson
On 10/26/09 Mon Oct 26, 2009 8:57 AM, "Bryan R Harris" scribbled: > > > Is there a good way to do printf's with currency symbols? > > I've tried this: > > printf "Total: \$%10.2f\n", $total; > > But it puts the dollar sign way out front (ugly). I want it to look like: > > Total:$

Re: AW: compact my wordlist generator

2009-10-26 Thread Jim Gibson
On 10/26/09 Mon Oct 26, 2009 8:45 AM, "Michael Alipio" scribbled: > Thanks for the advice. Forgive me if I sounded like someone who's frustrated, > couldn't do his homework asking somebody else for help. > > When I was learning C programming, I read that learning those difficult > algorithms s

Dear friend!

2009-10-26 Thread Pat Rice
Dear friend,I am willing to give you a big surprise. I found a website:  www.ollsu.com last week. They mainly sell phones , laptops, tvs ,digital cameras and motorbikes. I ordered a tv . now I have got the product after 5 days. Its quality is very good.By the way, they only sell new and original pr

Re: Dear friend!

2009-10-26 Thread Ian
On Mon, Oct 26, 2009 at 12:06 PM, Pat Rice wrote: > Dear friend,I am willing to give you a big surprise. > Friend, I'm willing to give you some good advice! use warnings; use strict; Read http://perldoc.perl.org/ Ian

AW: AW: compact my wordlist generator

2009-10-26 Thread Thomas Bätzler
Michael Alipio wrote: > I knew I needed a recursive function, I just didn't know how to start. That is usually the easy part - you start out by solving the problem for a base case, and then you embellish. With regard to your problem of generating all combinations of a set of elements, the base

Re: printf with currency symbols

2009-10-26 Thread Robert Citek
Is this what you are looking for: $ perl -e '$total = 24.15 ; printf "Total: \$%.2f\n", $total; ' Regards, - Robert On Mon, Oct 26, 2009 at 11:57 AM, Bryan R Harris wrote: > Is there a good way to do printf's with currency symbols? > > I've tried this: > >  printf "Total: \$%10.2f\n", $total; >

Re: printf with currency symbols

2009-10-26 Thread Robert Citek
I see. You want the output to look something like this: $ perl -e 'for(my $total = 24.15; $total <3; $total *= 10) { printf("Total:%10s\n", "\$" . sprintf("%.2f",$total)) ;} ' Total:$24.15 Total: $241.50 Total: $2415.00 Total: $24150.00 Not sure if there is a better way. My guess is

Re: printf with currency symbols

2009-10-26 Thread Shawn H Corey
Robert Citek wrote: > Not sure if there is a better way. My guess is that there is probably > some module to convert float to currency and then print it as a > string. But a quick Google didn't turn up anything. Here' why (extracted from `perldoc perllocale`): Category LC_MONETARY: Formattin

Re: printf with currency symbols

2009-10-26 Thread Bryan R Harris
> Robert Citek wrote: >> Not sure if there is a better way. My guess is that there is probably >> some module to convert float to currency and then print it as a >> string. But a quick Google didn't turn up anything. > > Here' why (extracted from `perldoc perllocale`): > >Category LC_MONET

Re: compact my wordlist generator

2009-10-26 Thread Philip Potter
2009/10/26 Michael Alipio : > Then as suggested (see far below), a recursive function will do what I want.. > After some googling I found this: > > > permutate(0,2); > > sub permutate($$){ > >  my ($cur,$max) = @_; > >  if ($cur>=$max){ >     print "$result\n"; >     return; >  } > >  for(@word){

Re: AW: compact my wordlist generator

2009-10-26 Thread Shlomi Fish
A bit of CS philosophy if you may... On Monday 26 Oct 2009 18:41:23 Jim Gibson wrote: > On 10/26/09 Mon Oct 26, 2009 8:45 AM, "Michael Alipio" > > scribbled: > > Thanks for the advice. Forgive me if I sounded like someone who's > > frustrated, couldn't do his homework asking somebody else for