in reply to [SOLVED] Troubles with building a hash slice

You almost certainly want something like:

my @data_from = $tmpline =~ m/ \s*(\d+) ;;(.+) ;;\s*(\d+) ;;\s*(\d+) ;;\s*(\d+) ;;\s*(\d+) ;;\s*(\d+) ;;\s*(\d+) ;;\s*(\d+) ;;(.+?) \s*;;\s*(.*?) \s*;;\s*(\d+) ;;(.+)\s* /x;

That is, use a m// and assign the captures directly to @data_from instead of using s/// and converting it to a string containing the captures which is not an array. You;d need to split it, but that would be pointless.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Troubles with building a hash slice
by CrazyDiamond (Initiate) on Jan 16, 2008 at 12:37 UTC
    hipowls, there is some '\s' in begining and at the end of fields, that i want to remove with pattern match, that's why i didnt use split.
    BrowserUk, thanks! That's much more beutiful, than my s/// & push, with same result!