Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: text to array

by Utilitarian (Vicar)
on Jun 06, 2013 at 08:34 UTC ( #1037410=note: print w/ replies, xml ) Need Help??


in reply to Re^2: text to array
in thread text to array

If your words are tab separated, the following should work

#!/usr/local/bin/perl use strict; use warnings; open (my $wordfile, '<', 'test1234.txt')|| die "Could not open test123 +4.txt, $!"; while (<$wordfile>){ print join ',', split(/\t/, $_); exit; }
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."


Comment on Re^3: text to array
Select or Download Code
Re^4: text to array
by torres09 (Acolyte) on Jun 06, 2013 at 09:29 UTC

    it does not work , stops after first line of document

      Sure, you say that, but you don't show 10 lines of file , you can use  perl -MData::Dump -MFile::Slurp -e " dd scalar read_file shift, { qw/ binmode :raw / }; "  tenlinefile > tenlinefileasperl.pl

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-12-22 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls