Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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?
[karlgoethebier]: Ouch! How can i link to a section in my profile?
[erix]: I suppose you have to add anchors yourself
[karlgoethebier]: erix: OK Trial and Error. Thanks
[LanX]: <a name='anchor'> ?
[erix]: I'd just try <a id="header text on page"></a>
[LanX]: yep

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-06-24 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (557 votes). Check out past polls.