Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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:


So your code should be

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


Replies are listed 'Best First'.
Re^2: Help with Regular Expressions and Perl
by afoken (Abbot) 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> };


    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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://832197]
[hippo]: Corion: Yes, you can. It's all in the pg_hba.conf
[erix]: yeah, but there is a lot SQLite cannot do :)
[hippo]: Database is the 2nd column.
shmem .oO( docker. docker. docker? docker. docker! docker )
[shmem]: at least, some Ook.
[erix]: another simple Pg thing is to running a database off a tsv (alas, readonly)
[erix]: I'm waiting for that zipfile-reading to show up in DBD::SQLite :)
[Corion]: hippo, erix: That sounds promising :)
[Corion]: erix: I misinterpreted that. It only allows to read a zipfile like a table, not reading a database from a zipfile :-(

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2018-02-23 15:18 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (302 votes). Check out past polls.