Re: Concatenating Strings

2008-03-25 Thread Bobby
Thanks for all your input, using a hash does make things a lot easier for me. Rob Dixon <[EMAIL PROTECTED]> wrote: kens wrote: > > # Or if you must use a counter > > my $count = 0; > > while ( defined($strA[$count]) ) > { >print "$strA[$count++]\n"; > } for my $count (0 .. $#strA) { p

Re: Concatenating Strings

2008-03-24 Thread Rob Dixon
kens wrote: # Or if you must use a counter my $count = 0; while ( defined($strA[$count]) ) { print "$strA[$count++]\n"; } for my $count (0 .. $#strA) { print "[$count] = $strA[$count]\n"; } **OR** my $count = 0; foreach (@strA) { print "[$count] = $strA[$count]\n"; $count++; }

Re: Concatenating Strings

2008-03-24 Thread Randal L. Schwartz
> "Bobby" == Bobby <[EMAIL PROTECTED]> writes: Bobby> I'm trying to write a simple do until loop to print out the value of Bobby> $strA0 through $striA3. If your variable names are named sequentially, you've almost always done something wrong. Please rethink your problem, keeping data struc

Re: Concatenating Strings

2008-03-24 Thread Rob Dixon
Bobby wrote: Hi all, I'm trying to write a simple do until loop to print out the value of > $strA0 through $striA3. What i'm doing is replacing the value of 0 > through 3 in the $strA by joining two strings (my $strB = "strA". > $count;). Right now my script is printing $strB as below. How do i

Re: Concatenating Strings

2008-03-24 Thread Gunnar Hjalmarsson
yitzle wrote: IIRC, Perl does not let you use a string to build a variable name like PHP does. Then you do not remember it correctly. If you do this: $myVar = 123; $varName = "myVar"; print "$varName"; You get "myVar" and not "123" Sure, but if you replace the last line with prin

Re: Concatenating Strings

2008-03-24 Thread kens
On Mar 24, 12:09 pm, [EMAIL PROTECTED] (Bobby) wrote: > Hi all, > > I'm trying to write a simple do until loop to print out the value of $strA0 > through $striA3. What i'm doing is replacing the value of 0 through 3 in the > $strA by joining two strings (my $strB = "strA" . $count;). Right now m

Re: Concatenating Strings

2008-03-24 Thread Gunnar Hjalmarsson
Bobby wrote: I'm trying to write a simple do until loop to print out the value of $strA0 through $striA3. What i'm doing is replacing the value of 0 through 3 in the $strA by joining two strings (my $strB = "strA" . $count;). Right now my script is printing $strB as below. How do i get perl t

Re: Concatenating Strings

2008-03-24 Thread Jenda Krynicky
> Bobby wrote: > Hi all, > > I'm trying to write a simple do until loop to print out the value of > $strA0 through $striA3. What i'm doing is replacing the value of 0 > through 3 in the $strA by joining two strings (my $strB = "strA" . > $count;). Right now my script is printing $strB as b

Re: Concatenating Strings

2008-03-24 Thread Wolf
Grab a perl book or search the web for concatenating variables together... Unfortunately the current place I am in doesn't have perl on the server for me to try and play around more, but the gist is the same. Your problem arise from setting it up as string during the concatination process. Set

Re: Concatenating Strings

2008-03-24 Thread Bobby
Thanks for both of your suggestions. I've tried them both but still getting same result. Any other suggestions? Thanks. Wolf <[EMAIL PROTECTED]> wrote: Bobby wrote: > Wolf, > > I still don't understand, so set my $strB = "$strA($count)"; ? That didn't > worked. > > Wolf wrote:

Re: Concatenating Strings

2008-03-24 Thread yitzle
IIRC, Perl does not let you use a string to build a variable name like PHP does. If you do this: $myVar = 123; $varName = "myVar"; print "$varName"; You get "myVar" and not "123" which seems to be what you want. However, I think you might be able to use hashes and get what you want. $hash{"

Re: Concatenating Strings

2008-03-24 Thread Wolf
Bobby <[EMAIL PROTECTED]> wrote: > Wolf, > > I still don't understand, so set my $strB = "$strA($count)"; ? That didn't > worked. > > Wolf <[EMAIL PROTECTED]> wrote: > Bobby wrote: > > Hi all, > > > > I'm trying to write a simple do until loop to print out the value of $strA0 >

Re: Concatenating Strings

2008-03-24 Thread Bobby
Wolf, I still don't understand, so set my $strB = "$strA($count)"; ? That didn't worked. Wolf <[EMAIL PROTECTED]> wrote: Bobby wrote: > Hi all, > > I'm trying to write a simple do until loop to print out the value of $strA0 > through $striA3. What i'm doing is replacing the value of 0

Re: Concatenating Strings

2008-03-24 Thread Wolf
Bobby <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm trying to write a simple do until loop to print out the value of $strA0 > through $striA3. What i'm doing is replacing the value of 0 through 3 in the > $strA by joining two strings (my $strB = "strA" . $count;). Right now my > script i