Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: process a file and reading a line and passing the values to another sub function

by Vijay81 (Acolyte)
on Dec 13, 2012 at 20:46 UTC ( #1008720=note: print w/ replies, xml ) Need Help??


in reply to process a file and reading a line and passing the values to another sub function

ok, finally i found out that we can use split function to put the comma seperated line into array element.

</codesub readout_file { my ($filename) = @_; my (@linecolumns); open my $fh, '<', $filename or die "can't open file:$!"; while (<$fh>) { chomp; ~s/ /,/g; ## OR s/ /,/g; if you want print $_, $/; @linecolumns = split(',',$_); #print $_, $/; ## OR any other subroutine you want print $linecolumns[0],$/; print $filename, $/; } }


Comment on Re: process a file and reading a line and passing the values to another sub function
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2015-07-05 21:51 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 (68 votes), past polls