Re: Question/Problem with foreach loop

2011-06-07 Thread CM Analyst
Gents, Sorry for my delayed response. Thank you for your suggestions. Based on your feedback, I made the following changes, and the hook is now working as expected. Thanks a million! my $taskstate = $taskEntity->GetFieldValue(state)->GetValue();     $session->OutputDebugString ("Task's state

Re: Question/Problem with foreach loop

2011-05-18 Thread Uri Guttman
> "CA" == CM Analyst writes: CA> my $taskEntity = $session->GetEntity ('almtask', $_); that gets a perl object in $taskEntity. CA> $taskEntity->GetFieldValue(state)->GetValue(); where is the value being assigned to? $taskEntity is not being modified or set in that line of code. it is j

Re: Question/Problem with foreach loop

2011-05-18 Thread Jim Gibson
On 5/18/11 Wed May 18, 2011 5:06 PM, "CM Analyst" scribbled: > Hi, > > In this code, the intent is to iterate through the tasks and modify the ID > field. The Task record (entity) should not be modified if it's state equals > "Completed". > > When I run this routine, there are two problems:

Question/Problem with foreach loop

2011-05-18 Thread CM Analyst
Hi, In this code, the intent is to iterate through the tasks and modify the ID field. The Task record (entity) should not be modified if it's state equals "Completed". When I run this routine, there are two problems: Problem 1) The "if" statement is not being evaluated. The record (even if it

Re: AW: Problem with foreach loop

2010-09-27 Thread Shlomi Fish
On Monday 27 September 2010 10:17:16 HACKER Nora wrote: > Hi Shlomi, > > > You shouldn't modify an array (@arr1 in this case) while iterating > > over it using > > > foreach. Otherwise, the results will be unpredictable. One option to > > overcome it is to do: > > > > [code] > > my @arr1_copy =

Re: Problem with foreach loop

2010-09-27 Thread John W. Krahn
HACKER Nora wrote: Hello list, Hello, Could someone please explain why this test script: my @arr1 = qw(one two three); my @arr2 = qw(1 2 3); foreach my $arr1 ( @arr1 ) { print "Arr1: $arr1\n"; foreach my $arr2 ( @arr2 ) { print "Arr2: $arr2\n";

AW: Problem with foreach loop

2010-09-27 Thread HACKER Nora
Hi Shlomi, > You shouldn't modify an array (@arr1 in this case) while iterating over it using > foreach. Otherwise, the results will be unpredictable. One option to > overcome it is to do: > > [code] > my @arr1_copy = @arr1; > > while (defined (my $arr1_elem = shift(@arr1_copy))) { > # Do

Re: AW: Problem with foreach loop

2010-09-27 Thread Shlomi Fish
On Monday 27 September 2010 09:40:43 HACKER Nora wrote: > Hi Michael, > > > > Thanks for your fast reply. I didn't realize that the shift is of > immediate effect not only to the array but also to the current element > of iteration in the loop itself. > It may be. However, that is besides the

Re: Problem with foreach loop

2010-09-27 Thread Rob Coops
On Mon, Sep 27, 2010 at 9:19 AM, HACKER Nora wrote: > Hello list, > > Could someone please explain why this test script: > > my @arr1 = qw(one two three); > my @arr2 = qw(1 2 3); > > foreach my $arr1 ( @arr1 ) { >print "Arr1: $arr1\n"; >foreach my $arr2 ( @arr2 ) { >

AW: Problem with foreach loop

2010-09-27 Thread HACKER Nora
ember 2010 09:34 An: HACKER Nora Betreff: Re: Problem with foreach loop When $arr2 eq '2', you shift 'one' off @arr1, but you're still working with$ arr[0], which is now 'two'. When the second foreach ends, it moves onto $arr1[1], which is 'three'

Re: Problem with foreach loop

2010-09-27 Thread Shlomi Fish
Hi Nora, On Monday 27 September 2010 09:19:46 HACKER Nora wrote: > Hello list, > > Could someone please explain why this test script: > > my @arr1 = qw(one two three); > my @arr2 = qw(1 2 3); > > foreach my $arr1 ( @arr1 ) { > print "Arr1: $arr1\n"; > foreach my $arr2 ( @arr2 )

WG: Problem with foreach loop

2010-09-27 Thread HACKER Nora
ndet: Montag, 27. September 2010 09:20 > An: beginners@perl.org > Betreff: Problem with foreach loop > > Hello list, > > Could someone please explain why this test script: > > my @arr1 = qw(one two three); > my @arr2 = qw(1 2 3); > > foreach my $arr1 ( @arr1 ) { >

Problem with foreach loop

2010-09-27 Thread HACKER Nora
Hello list, Could someone please explain why this test script: my @arr1 = qw(one two three); my @arr2 = qw(1 2 3); foreach my $arr1 ( @arr1 ) { print "Arr1: $arr1\n"; foreach my $arr2 ( @arr2 ) { print "Arr2: $arr2\n"; if ( $arr2 eq '2' ) {

Re: Problem with foreach

2005-12-12 Thread John W. Krahn
Andrej Kastrin wrote: > John W. Krahn wrote: > >> Andrej Kastrin wrote: >>> >>> I want to count words in the following file: >>> -- >>> ID- some number >>> TI- some text BB >>> AB- some text A BB >>> AU- some text >>> >>> ID- some number >>> TI- some GGG text >>> AB- s

Re: Problem with foreach

2005-12-12 Thread Andrej Kastrin
John W. Krahn wrote: Andrej Kastrin wrote: Hello dears, Hello, I want to count words in the following file: -- ID- some number TI- some text BB AB- some text A BB AU- some text ID- some number TI- some GGG text AB- some text GGG AU- some text ID- som

Re: Problem with foreach

2005-12-12 Thread John W. Krahn
Andrej Kastrin wrote: > Hello dears, Hello, > I want to count words in the following file: > -- > ID- some number > TI- some text BB > AB- some text A BB > AU- some text > > ID- some number > TI- some GGG text > AB- some text GGG > AU- some text > > ID- some number >

Problem with foreach

2005-12-12 Thread Andrej Kastrin
Hello dears, I want to count words in the following file: -- ID- some number TI- some text BB AB- some text A BB AU- some text ID- some number TI- some GGG text AB- some text GGG AU- some text ID- some number TI- some text AB- some text Z AU- some text --

Re: Problem with Foreach in If Statement...

2005-06-04 Thread Frank Lee
please try this one: #tested in linux #!/usr/bin/perl -w use strict; my @names = qw( fred barney betty wilma dino ); print "Enter some numbers 1 to 5, one per line, then press ctrl D:\n"; chomp (my @numbers = ); foreach (@numbers){ if ($_ < 6){ print "$names[$_ - 1]\n"; }else{

Re: Problem with Foreach in If Statement...

2005-06-04 Thread John W. Krahn
Hakim Singhji wrote: Hi All, Hello, This is my first post at beginners. I am working with Learning Perl (Llama!) and I like to tweak some of the problems and create more creative solutions to some things. I cannot figure out why this is not working. Can anyone point out an error in my code.

Problem with Foreach in If Statement...

2005-06-04 Thread Hakim Singhji
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi All, This is my first post at beginners. I am working with Learning Perl (Llama!) and I like to tweak some of the problems and create more creative solutions to some things. I cannot figure out why this is not working. Can anyone point out an erro

Re: problem with foreach and while with array

2002-08-28 Thread Priss
Thank you Connie for helping me on this, it was fixed by below comment you made :))) >> SOA: while () >> { >> chomp; > >You don't need to chomp it, or you don't need $/ at >last of the next line. Priss __ Do You Yahoo!? Everything you'll

Re: problem with foreach and while with array

2002-08-28 Thread Connie Chan
> > Wonder if someone could help me, I am trying to write > a script to pulls out all the machine names from a > revese DNS file, some how, my script will only print > out the machine names with 1.x.x.in-addr.arpa > > $nslookup = '/usr/local/bin/nslookup'; > $dig = '/usr/local/bin/dig'; >

problem with foreach and while with array

2002-08-28 Thread Priss
Hiya, Wonder if someone could help me, I am trying to write a script to pulls out all the machine names from a revese DNS file, some how, my script will only print out the machine names with 1.x.x.in-addr.arpa $nslookup = '/usr/local/bin/nslookup'; $dig = '/usr/local/bin/dig'; @ZONES = qw