Win has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: $line = trim($line);
by japhy (Canon) on Feb 06, 2006 at 13:23 UTC
    "trim" is a really poor name for a function that inserts tabs into a string. I'd name it "add_tabs" or something.

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
Re: $line = trim($line);
by xdg (Monsignor) on Feb 06, 2006 at 12:47 UTC

    Can you elaborate on what your expectations are? Please give an example of input and output.

    The one thing that does jump out is that 85+ means an 8 followed by one or more 5's. Is that what you intended or do you mean a literal plus sign? (Which would need a backslash escape: 85\+).

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: $line = trim($line);
by terce (Friar) on Feb 06, 2006 at 12:42 UTC

    It's difficult to guess what the problem might be without some more information:

    What is the input data?

    What output are you expecting?

    How is the code failing to do what you expect?

Re: $line = trim($line);
by ikegami (Patriarch) on Feb 06, 2006 at 12:46 UTC
    Judging by the rest of the code, 85+ probably should be 85\+. Beyond that, we need to know what you need this function to do. Are you using us in lieu of testing?
Re: $line = trim($line);
by Anonymous Monk on Feb 06, 2006 at 14:33 UTC
    Well.. as my predecessors have stated do we need more information to say anything that would help. Are your arguments (stored in @_) ok, do you just need /g at the end of your s///, as ikegami already mentioned is "+" in this case not a regular char as you would expect. Just from aspects such as style and efficiency you could do things in case switch or in a more elaborate regex or something more pleasant to the perlish eye.
Re: $line = trim($line);
by swampyankee (Parson) on Feb 06, 2006 at 17:57 UTC

    Well, how do you expect it to work? What should it be doing?

    No one can help you without those fairly basic questions being answered.

    emc

    " When in doubt, use brute force." — Ken Thompson