http://qs321.pair.com?node_id=11118615


in reply to Re^2: Case insensitive string comparison (updated x2)
in thread Case insensitive string comparison

... a ref to a single scalar ...

My guess about a possible rationale for this is that the strings being handled are in reality very long and DAN0207 wants to avoid making a bunch of copies of these long strings (e.g., to pass to subroutines). In a case like this, I'd agree that taking a reference to a scalar (string) and passing it around could be quite advantageous in the right circumstances. But this is all just guesswork.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^4: Case insensitive string comparison (updated x2)
by Marshall (Canon) on Jun 29, 2020 at 08:23 UTC
    My guess is that the OP has an array of similar lines, not just a ref to a single line. If he wants to send that array info to a sub, then pass a reference to that array. The OP provided nothing in terms of work flow and we are left to guess. With the info given, passing a ref to a single line doesn't appear to make any sense. Passing a ref to the entire array of strings would make sense.

    I also don't really understand why some csv lines should be transformed into a single token and others left as they are. This transformation is presumably being done for some future processing. Ok, what processing is that? And why is condensing a subset of lines to a particular single token result necessary?

    Maybe what is of interest are the lines that don't match the pattern? Maybe the returned array should be limited to the lines that don't match? I have no idea because this is application specific.