Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 pondering the Monastery: (8)
As of 2014-12-27 01:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (176 votes), past polls