Solved

variable plus text

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

16 Experts available now in Live!

Get 1:1 Help Now