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
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++;
}
> "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
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
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
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
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
> 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
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
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:
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{"
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
>
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
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
14 matches
Mail list logo