Solved

variable plus text

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

Accepted Solution

by:
ozo earned 500 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now