Re: Subroutine doesn't write to file

2010-04-11 Thread Uri Guttman
> "PP" == Philip Potter writes: PP> On 12 April 2010 04:31, Uri Guttman wrote: >>> "AM" == Abimael Martinez writes: >> >>  AM>   print {$tmp} "$div_start"; >> >> no need for the {} around a single scalar handle. PP> But it *does* comply with Perl Best Practices #136.

Re: Subroutine doesn't write to file

2010-04-11 Thread Philip Potter
On 12 April 2010 04:31, Uri Guttman wrote: >> "AM" == Abimael Martinez writes: > >  AM>   print {$tmp} "$div_start"; > > no need for the {} around a single scalar handle. But it *does* comply with Perl Best Practices #136. * It makes the filehandle obviously different from the other argumen

Re: about split and \d or . (.)

2010-04-11 Thread John W. Krahn
Harry Putnam wrote: What I'm working on will eventually be a script that reads an `events' file and lets me know about events I've entered there. It's my own primitive but hopefully effective calendar reminder type of tool. The format of entries look like this: cat ~/.events ev 100411 4

Re: Subroutine doesn't write to file

2010-04-11 Thread John W. Krahn
Abimael Martinez wrote: Hi, Hello, I am having some problems making this little script work, it is supposed glob files from current dir, and add stuff at the top and bottom of such files. I am also unshure how the "autoflush" works. use strict; use IO::File; use IO::Handle qw( ); my @

Re: Subroutine doesn't write to file

2010-04-11 Thread Uri Guttman
> "AM" == Abimael Martinez writes: AM> Hi, AM> I am having some problems making this little script work, it is supposed AM> glob files from current dir, and add stuff at the top and bottom of such AM> files. I am also unshure how the "autoflush" works. AM> use strict; AM> u

Subroutine doesn't write to file

2010-04-11 Thread Abimael Martinez
Hi, I am having some problems making this little script work, it is supposed glob files from current dir, and add stuff at the top and bottom of such files. I am also unshure how the "autoflush" works. use strict; use IO::File; use IO::Handle qw( ); my @web_docs = <*.html>; my @excluded =

Re: about split and \d or . (.)

2010-04-11 Thread Harry Putnam
Shawn H Corey writes: > Harry Putnam wrote: >> I thought I understood you but when I run a modified script (at the >> end) I see empty elements where I don't expect them. >> >> The actual thing I'm working up to was splitting this input var >> >> `ev 100421 4' >> >> In reality I want to ditch `e

How ro specify path in "use lib qw()"

2010-04-11 Thread Mimi Cafe
My program is in the same directory as my module directory, but when I use relative path in use lib, Perl doesn't find the module. use lib qw(MyModule/), use lib qw(./MyModule/), use lib qw(MyModule) or use lib qw(./MyModule/) # these don't work. use lib qw(/var/www/cgi-bin/MyProject/) #

Re: beginner projects

2010-04-11 Thread Uri Guttman
> "HP" == Harry Putnam writes: HP> "Steve Bertrand" writes: HP> [...] >> ...I'm very willing to accept all feedback, and can accept such feedback >> humbly ( sometimes after a period of embarrassment and self-loathing ). HP> [...] HP> Steve, just wanted to tell you that I real

Re: about split and \d or . (.)

2010-04-11 Thread Uri Guttman
> "AHA" == Alan Haggai Alavi writes: AHA> split considers the pattern given to it, as a delimiter within the AHA> expression. Let us consider the three cases: >> my @elems1 = split(/\d/,$var); AHA> Digits are the delimiters. Delimiters are stripped out of the string AHA> by split.

Re: about split and \d or . (.)

2010-04-11 Thread Uri Guttman
> "JWK" == John W Krahn writes: JWK> Uri Guttman wrote: >>> "HP" == Harry Putnam writes: >> HP> elems1 ( `split(/(\d\d)/,100421)' ): HP> has these elements: HP> I'm an element -> <> >> >> that is because there is always a leading null string between the start JWK>

Re: about split and \d or . (.)

2010-04-11 Thread John W. Krahn
Uri Guttman wrote: "HP" == Harry Putnam writes: HP> elems1 ( `split(/(\d\d)/,100421)' ): HP> has these elements: HP> I'm an element -> <> that is because there is always a leading null string between the start ITYM: almost always and a leading deli

Re: about split and \d or . (.)

2010-04-11 Thread John W. Krahn
Alan Haggai Alavi wrote: On 11 April 2010 21:10, Harry Putnam wrote: Why is it that the first two splits do not produce any elements? #!/usr/local/bin/perl use strict; use warnings; my $var = 100421; my @elems1 = split(/\d/,$var); my @elems2 = split(/./,$var); my @elems3 = split(//,$var);

Re: about split and \d or . (.)

2010-04-11 Thread Alan Haggai Alavi
On 11 April 2010 21:10, Harry Putnam wrote: > Why is it that the first two splits do not produce any elements? > > #!/usr/local/bin/perl > > use strict; > use warnings; > > my $var = 100421; > my @elems1 = split(/\d/,$var); > my @elems2 = split(/./,$var); > my @elems3 = split(//,$var); > > if (@el

Re: about split and \d or . (.)

2010-04-11 Thread Shawn H Corey
Harry Putnam wrote: I thought I understood you but when I run a modified script (at the end) I see empty elements where I don't expect them. The actual thing I'm working up to was splitting this input var `ev 100421 4' In reality I want to ditch `ev ' work with 100421 and finally use ` 4' f

Re: beginner projects

2010-04-11 Thread Harry Putnam
"Steve Bertrand" writes: [...] > ...I'm very willing to accept all feedback, and can accept such feedback > humbly ( sometimes after a period of embarrassment and self-loathing ). [...] Steve, just wanted to tell you that I really got a kick out of that comment. It so aptly describes my own re

Re: about split and \d or . (.)

2010-04-11 Thread Harry Putnam
"Uri Guttman" writes: > that is splitting on the null string which exists BETWEEN each pair of > chars. it doesn't leave a null leading string for some good reason i > can't remember and i am not in the mood to rtfm. so its function will > always be to split a string into a list of its chars. cla

Re: about split and \d or . (.)

2010-04-11 Thread Uri Guttman
> "HP" == Harry Putnam writes: >> split discards the pattern split on. To keep it, place it in parentheses. >> >> my @elems = split( /(\d)/, $var ); HP> [...] HP> Oh GACK... I knew that too.. but lost my wits I guess. it is easy to remember with this line (from randal schwartz)

Re: about split and \d or . (.)

2010-04-11 Thread Harry Putnam
Shawn H Corey writes: > Harry Putnam wrote: >> Why is it that the first two splits do not produce any elements? >> >> #!/usr/local/bin/perl >> >> use strict; >> use warnings; >> >> my $var = 100421; >> my @elems1 = split(/\d/,$var); >> my @elems2 = split(/./,$var); >> my @elems3 = split(//,$var);

Re: about split and \d or . (.)

2010-04-11 Thread John W. Krahn
Harry Putnam wrote: Why is it that the first two splits do not produce any elements? Because: perldoc -f split split /PATTERN/,EXPR,LIMIT split /PATTERN/,EXPR split /PATTERN/ split Splits the string EXPR into a list of strings and returns that list. By default,

Re: about split and \d or . (.)

2010-04-11 Thread Robert Wohlfarth
On Sun, Apr 11, 2010 at 10:40 AM, Harry Putnam wrote: > Why is it that the first two splits do not produce any elements? > > #!/usr/local/bin/perl > > use strict; > use warnings; > > my $var = 100421; > my @elems1 = split(/\d/,$var); > my @elems2 = split(/./,$var); > my @elems3 = split(//,$var);

Re: about split and \d or . (.)

2010-04-11 Thread Shawn H Corey
Harry Putnam wrote: Why is it that the first two splits do not produce any elements? #!/usr/local/bin/perl use strict; use warnings; my $var = 100421; my @elems1 = split(/\d/,$var); my @elems2 = split(/./,$var); my @elems3 = split(//,$var); split discards the pattern split on. To keep it, p

about split and \d or . (.)

2010-04-11 Thread Harry Putnam
Why is it that the first two splits do not produce any elements? #!/usr/local/bin/perl use strict; use warnings; my $var = 100421; my @elems1 = split(/\d/,$var); my @elems2 = split(/./,$var); my @elems3 = split(//,$var); if (@elems1){ print "elems1 has these elements:\n"; for(@elems1){

Re: Perl: Subroutines and use of the "GD::Graph::bars;" Module

2010-04-11 Thread alekto
Hi! I did what you told me, but I just gets this error msg in return when I am trying to execute the script: Invalid data set: 0 at ./test.pl line 105, line 1. This error is referring to this line in my script: my $gd = $graph->plot($ydata) or die $graph->error; I seems like there is somethin