Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

string processing

Michael32180Michael32180 Posts: 1Member
i have a string and i would like to be able to pull out the words in the string and store them, in either an array or a hash. all the words are separated by one or more spaces and consist of numeric values, alpha-numeric words, dates, and times. the string was pulled from a log file. i need to display the most recent line in the log file and output the different values. any help would be appreciated! thanks

Comments

  • XfactorXfactor Posts: 343Member
    : i have a string and i would like to be able to pull out the words in the string and store them, in either an array or a hash. all the words are separated by one or more spaces and consist of numeric values, alpha-numeric words, dates, and times. the string was pulled from a log file. i need to display the most recent line in the log file and output the different values. any help would be appreciated! thanks
    :
    The easiest way that I know of is to use the split command. The syntax is:

    @array = split /pattern/, $string

    @array is the array that is returned after the split is executed
    pattern what you are parsing on. This is usually a regular expression.
    $string is the string you are parsing.

    I hope this helps.

    X
Sign In or Register to comment.