CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Joining Text and Numbers ?

 



John123
Deleted

Dec 18, 2000, 9:06 PM

Post #1 of 2 (136 views)
Joining Text and Numbers ? Can't Post

Im very new in perl and would like to do some kind of counter with the combination of a text word:

my($temp1,$temp2,$temp3);
$temp1 = "field";
$temp2 =1;
$temp2++;
$temp3 = join($temp1,$temp2);

Needs help...........



japhy
Enthusiast

Dec 18, 2000, 9:09 PM

Post #2 of 2 (135 views)
Re: Joining Text and Numbers ? [In reply to] Can't Post

As documented in perldoc -f join (that's the specific excerpt from perldoc perlfunc), the first argument to join() is the string to join the variables with:


Code
my $text = 'field'; 
my $num = 1;
my $counter = join "--", $text, $num;
print $counter; # field--1

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives