Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Help with Regular Expressions and Perl

by Punitha (Priest)
on Apr 01, 2010 at 04:20 UTC ( #832197=note: print w/ replies, xml ) Need Help??


in reply to Help with Regular Expressions and Perl

Hi vc859,

The syntax for 'join' is:

join EXPR,LIST

So your code should be

$variable = join("\n",@variable = <INFILE>);

Punitha


Comment on Re: Help with Regular Expressions and Perl
Select or Download Code
Replies are listed 'Best First'.
Re^2: Help with Regular Expressions and Perl
by afoken (Prior) on Apr 01, 2010 at 19:29 UTC

    Just a small note: Using slurp mode is usually far more efficient than join()ing a temporary array or list.

    $variable=do { local $/=undef; <INFILE> };

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^2: Help with Regular Expressions and Perl
by amedico (Sexton) on Apr 03, 2010 at 23:44 UTC
    Although the questioner probably does not want to be using join here at all - reading the file via <INFILE> does not remove the file's newlines, so there is probably no need to be adding more.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://832197]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2015-07-29 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls