![]() |
|
Do you know where your variables are? | |
PerlMonks |
Re: Extracting selected fields form file record (updated)by LanX (Saint) |
on Feb 06, 2022 at 18:56 UTC ( #11141174=note: print w/replies, xml ) | Need Help?? |
ehm ... > > spaces before and after the spaces before are IMHO best dealt by stripping them before splitting. ° $line =~ s/^\s+//; Even your pseudo python code can't do this in a one-liner with split (IMHO). But more importantly your definition of "field" is fuzzy now. Please clarify
updateprovided there are no "empty fields" and "multiple whitespaces" are allowed as separators: You can use a regex like /(\S+)/g ( \S is non-whitespace, the opposite of \s) Debugger demo:
Cheers Rolf
update°) or by using the magic of ' ' soonix showed us here.
In Section
Seekers of Perl Wisdom
|
|