Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: Concatenati...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 10785 of 11982
Post > Topic >>

Re: Concatenating Strings

by lonewolf@[EMAIL PROTECTED] (Wolf) Mar 24, 2008 at 01:39 PM

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 the responses in an array and just walk the array for a quick and
dirty solution.


---- Bobby <cybercruiserz@[EMAIL PROTECTED]
> wrote: 
> Thanks for both of your suggestions. I've tried them both but still
getting same result.  Any other suggestions?   
> 
> Thanks.  
> 
> Wolf <lonewolf@[EMAIL PROTECTED]
> wrote: 
> ---- Bobby  wrote: 
> > Wolf,
> > 
> > I still don't understand, so set my $strB = "$strA($count)"; ? That
didn't worked. 
> > 
> > Wolf  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 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 to print the
value of $strA0 through $strA3 inside of my do until loop?  i.e.:
> > > 
> > > Desired Outcome:
> > > VarB: A0
> > > VarB: A1,b,c
> > > VarB: A 2
> > > VarB: A3,d,e
> > > 
> > > Current Outcome: 
> > > VarB:strA0
> > > VarB:strA1
> > > VarB:strA2
> > > VarB:strA3
> > > 
> > > 
> > > #!/usr/bin/perl
> > > use strict;
> > > use warnings;
> > > 
> > > my $strA0="A0";
> > > my $strA1="A1,b,c";
> > > my $strA2="A2";
> > > my $strA3="A3,d,e";
> > > 
> > > my $count = 0;
> > >   until ($count == 4){
> > >      my $strB = "strA" . $count;
> > >     print "VarB:$strB\n";
> > >   $count++;
> > > }#end until loop
> > > 
> > > Thanks,
> > > 
> > > Mike
> > 
> > You can either turn them into an array and walk the array with your
count
> > 
> > You are setting $strB as the string strA instead of $strA($count)
which is where you are getting hosed up.
> > 
> > My perl server is down or I'd play with the code a bit to get it the
exact answer, but that should point you in the right direction.
> > 
> > HTH,
> > Wolf
> > 
> 
> No Bobby, more along the lines of:
>  my $B = "strA" .$count;
>  my $strB = $B;
>  print "VarB:$strB\n";
> 
> But you are going to have to keep playing with it if it doesn't work
right.
> 
> Wolf
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@[EMAIL PROTECTED]
> For additional commands, e-mail: beginners-help@[EMAIL PROTECTED]
> http://learn.perl.org/
> 
> 
> 
> 
>        
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try
it now.
 




 1 Posts in Topic:
Re: Concatenating Strings
lonewolf@[EMAIL PROTECTED  2008-03-24 13:39:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 1:44:48 CDT 2008.