variable plus text

Posted on 2013-05-27
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

Question by:stakor
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
LVL 84

Accepted Solution

ozo earned 500 total points
ID: 39200020
$file5 = "${name}5.txt";
$file5 = $name."5.txt";
$file5 = "$name\E5.txt";
$file5 = join'',$name,"5.txt";
$file5 = join'5.txt',$name,'';  
$file5 = "$name${\'5.txt'}";
LVL 84

Expert Comment

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remove Malware code from PHP file 6 100
Check file date before getting folder path 1 85
Call Shell Script from Perl Script 6 166
Perl File::Find alternative 1 87
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
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…

730 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