Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

variable plus text

Posted on 2013-05-27
2
Medium Priority
?
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 84

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 84

Expert Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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

609 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