[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

variable plus text

Posted on 2013-05-27
2
Medium Priority
?
176 Views
Last Modified: 2013-05-27
I am trying to get $file5 to equal thing5.txt. I am having trouble assigning the variable to be a variable, followed by other text. This has to be very simple, but I have goofed it up one too many times in a row...

$name = "thing";

#$file5 = "thing5.txt";
$file5 = "$name5.txt";

print "$file5 \n";

Open in new window

0
Comment
Question by:stakor
  • 2
2 Comments
 
LVL 85

Accepted Solution

by:
ozo earned 2000 total points
ID: 39200020
$file5 = "${name}5.txt";
or
$file5 = $name."5.txt";
or
$file5 = "$name\E5.txt";
or
$file5 = join'',$name,"5.txt";
or
$file5 = join'5.txt',$name,'';  
or
($file5=$name).='.txt';
or
$file5 = "$name${\'5.txt'}";
0
 
LVL 85

Expert Comment

by:ozo
ID: 39200061
($file5=$name).='.txt'; should have been
($file5=$name).='5.txt';
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question