Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Using Split functionby perldigious (Priest) |
on Nov 27, 2019 at 21:43 UTC ( [id://11109328]=note: print w/replies, xml ) | Need Help?? |
You have a simple syntax error in your call of the built in split function.
If you are working through Learning Perl, Chapter 9 explains some basic usage of split. If you are like me and forget syntax easily, try to remember that things like split and print are built in functions of Perl and as such should be treated like any subroutine call where you wrote the subroutine (just no "&" ever necessary, see Chapter 4 of Learning Perl :-)). You can even wrap parenthesis around the list (list implies comma separators) of arguments you are passing them for clarity... e.g.
EDIT: Also, if you are only looking to extract certain items of your list for each line, and you know their index locations in the array you split them in to, you may want to take a look at array slices which are covered in Chapter 17 of Learning Perl.
Just another Perl hooker - My clients appreciate that I keep my code clean but my comments dirty.
In Section
Seekers of Perl Wisdom
|
|