Re: positions of matches

2008-10-09 Thread Vyacheslav Karamov
Rob Dixon пишет: Vyacheslav Karamov wrote: I've solved my problem with captures, but I don't understand how to get positions of matches: my $regex = qr { (?i) # Case-insensitive ( [\x{2022}\*]* # Any number of bullet or asterisk characters [1-9]+ # One or more digits 1-9 \s* # Any number of

Re: $o->document vs $o->document()

2008-10-09 Thread Peter Scott
On Wed, 08 Oct 2008 04:59:19 -0700, John W. Krahn wrote: > oldyork90 wrote: >> I am using a module having documentation saying document() is a >> method. However, I see it used as >> >> $o->document; >> >> Can you reference a method in this way? (I takes no args). I always >> thought >> >> $o

Re: use variables from another file

2008-10-09 Thread Noah
Jeff, thanks for your response. here is the output: --- snip --- $ ./program.pl done localhost$ --- snip --- here is how I used it: localhost$ cat ./program.pl #!/sw/bin/perl use Expect; use strict; my @elementList; my $elementfile = './test.pl'; eval {require $elementfile}; for my

Re: use variables from another file

2008-10-09 Thread Jeff Pang
> Message du 09/10/08 11:58 > De : "Noah" > A : "Jeff Pang" > Copie à : "Perl Beginners" > Objet : Re: use variables from another file > > my @elementList; > replace the line above to: our @elementList; For the reasons, see pls: http://perl.plover.com/FAQs/Namespaces.html Regards, Jeff.

Re: positions of matches

2008-10-09 Thread Rob Dixon
Vyacheslav Karamov wrote: > Rob Dixon пишет: >> >> foreach my $citation (@vancouverCites) { >> >> print qq(Text = "$citation"\n); >> >> while ($citation =~ /$regex/g) { >> print qq(pos = $-[0] to $+[0]\n); >> } >> print "\n"; >> } >> >> I hope this helps, >> >> Rob >> >>

Re: certification for perl

2008-10-09 Thread Raymond Wan
Hi all, Jeff Pang wrote: > Message du 09/10/08 13:36 De : "Praveena Vittal" A : "Rob Dixon" Copie à : "Perl Beginners" , "Jeff Pang" Objet : Re: certification for perl Hi All, Thanks for your suggestion . First of all ,i was shocked to see the list of books. No shocking. I was

Re: certification for perl

2008-10-09 Thread Praveena Vittal
Hi All, Thanks for your suggestion . First of all ,i was shocked to see the list of books. Also I got the safari resource library from where we can enrich our knowledge.Thanks for that. Regards, Praveena Rob Dixon wrote: Jeff Pang wrote: Message du 06/10/08 14:22 De : "Praveena Vittal

Re: certification for perl

2008-10-09 Thread Jeff Pang
> Message du 09/10/08 13:36 > De : "Praveena Vittal" > A : "Rob Dixon" > Copie à : "Perl Beginners" , "Jeff Pang" > Objet : Re: certification for perl > > > Hi All, > > Thanks for your suggestion . > > First of all ,i was shocked to see the list of books. > No shocking. I was once seeing more Pe

printing array elements

2008-10-09 Thread Charlie Farinella
I have a string of text that I want to split on the tabs: while () { my @array = split(/\t/, $_); ...manipulate them a little, and print them back out like so: print "$array[0],$array[1],$array[2]"; etc. } I normally just print them as above, but I'm thinking there must be a better way

Re: printing array elements

2008-10-09 Thread Martin Barth
Hey, > print "$array[0],$array[1],$array[2]"; etc. There are different ways: 1) print @array; usually you want to see which element is at which index so 2) print join(" - ", @array); is maybe better. HTH Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

Re: printing array elements

2008-10-09 Thread Charlie Farinella
On Thursday 09 October 2008, Charlie Farinella wrote: > I have a string of text that I want to split on the tabs: > > while () { > my @array = split(/\t/, $_); > > ...manipulate them a little, and print them back out like so: > > print "$array[0],$array[1],$array[2]"; etc. > } > > I nor

Re: printing array elements

2008-10-09 Thread Rob Dixon
Charlie Farinella wrote: > > I have a string of text that I want to split on the tabs: > > while () { > my @array = split(/\t/, $_); > > ...manipulate them a little, and print them back out like so: > > print "$array[0],$array[1],$array[2]"; etc. > } > > I normally just print them as ab

Re: printing array elements

2008-10-09 Thread John W. Krahn
Charlie Farinella wrote: I have a string of text that I want to split on the tabs: while () { my @array = split(/\t/, $_); ...manipulate them a little, and print them back out like so: print "$array[0],$array[1],$array[2]"; etc. } I normally just print them as above, but I'm thinking

Re: printing array elements

2008-10-09 Thread Mr. Shawn H. Corey
On Thu, 2008-10-09 at 16:53 -0400, Charlie Farinella wrote: > I have a string of text that I want to split on the tabs: > > while () { > my @array = split(/\t/, $_); > > ...manipulate them a little, and print them back out like so: > > print "$array[0],$array[1],$array[2]"; etc. > } > >

writing to a .txt file issues

2008-10-09 Thread David
My simple program works well in the terminal window: #!/usr/bin/perl -w use strict; my $answer; for ($a = 1; $a <= 100; $a++) { for ($b = 1; $b <= 100; $b++) { $answer = ($a-$b); print "$a - $b\t$answer\n"; } } Output: 1 - 1 0 1 - 2 -1 1 - 3 -2 1 -

Re: writing to a .txt file issues

2008-10-09 Thread Dave Tang
Try taking away the "+" in your filehandle line, so that it reads: open (WRITE,">/Users/dave/Documents/Programming/Perl/081008mathables/add.txt"); Dave On Fri, 10 Oct 2008 09:31:02 +1000, David <[EMAIL PROTECTED]> wrote: open(WRITE,"+>/Users/dave/Documents/Programming/Perl/081008mathtables

Re: writing to a .txt file issues

2008-10-09 Thread David
Try taking away the "+" in your filehandle line, so that it reads: open (WRITE,">/Users/dave/Documents/Programming/Perl/081008mathables/add.txt"); No, that didn't work. Program changed to: #!/usr/bin/perl -w use strict; my $answer; open(WRITE,">/Users/dave/Documents/Programming/Perl/081008ma

Re: writing to a .txt file issues

2008-10-09 Thread John W. Krahn
David wrote: My simple program works well in the terminal window: #!/usr/bin/perl -w use strict; my $answer; for ($a = 1; $a <= 100; $a++) { for ($b = 1; $b <= 100; $b++) { $answer = ($a-$b); print "$a - $b\t$answer\n"; } } Output: 1 - 1 0 1 - 2 -1 1

Re: writing to a .txt file issues

2008-10-09 Thread Mr. Shawn H. Corey
On Thu, 2008-10-09 at 19:31 -0400, David wrote: > However, when I insert some code to write to a file it fails an odd death: > > #!/usr/bin/perl -w > use strict; use warnings; # This is preferred over the -w in the shebang line # use diagnostics; # This may replace warnings and gives a long expla

Re: writing to a .txt file issues

2008-10-09 Thread David
Thank you, everyone who helped me. I greatly appreciate this. -David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/