Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

making a new string out of many old ones

by redpaw (Novice)
on Jul 14, 2000 at 01:38 UTC ( [id://22461]=perlquestion: print w/replies, xml ) Need Help??

redpaw has asked for the wisdom of the Perl Monks concerning the following question:

I know that this is probably very easy and the answer is probably staring me in the face but say I have
$a = "this"; $b = "is"; $c = "a"; $d = "sentence";
and I want to make one string that looks like

this|is&a|sentence

so that I have one $sentenceString that equals the above I want the pipes and "&" symbols in the string as well because that is the format of the database file I need to test against
been searching everywhere but to no avail... syntax is not my friend... yet.. thanks in advance -redpaw

Replies are listed 'Best First'.
Re: making a new string out of many old ones
by plaid (Chaplain) on Jul 14, 2000 at 01:41 UTC
    Maybe i don't understand your question.. what won't work about
    $sentence = "$a|$b&$c|$d";
      well it seems to not work in CGI land .... I get a server error every time I try that
        Ok I goofed... this was an unfortunately annoying little problem which was a combonation of 3 different errors which I just figured out all at once...
        the double quotes work fine thanks for the extremely quick replies all !!! -REDPAW
(chromatic) Re: making a new string out of many old ones
by chromatic (Archbishop) on Jul 14, 2000 at 02:03 UTC
    For the sake of completeness, there's a concatenation operator -- the noble period.
    my $first = "This is the whole "; my $second = "of the sentence."; my $full = $first . $second;
    But using double-quotish interpolation is definitely the way to go here.
Re: making a new string out of many old ones
by infoninja (Friar) on Jul 14, 2000 at 01:42 UTC
    One way:
    $sentenceString = "$a|$b&$c|$d";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://22461]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-18 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found