: 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.