|Do you know where your variables are?|
Re: Extracting selected fields form file record (updated)by LanX (Saint)
|on Feb 06, 2022 at 18:56 UTC||Need Help??|
> > 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.
provided 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)