On Tue, 3 May 2005, Greg Sheridan wrote:

> $dose_density =~ s/[A-Za-z\/ ]//g;

This is a substitution: s/// is the usual syntax for this.

Substutions take a match between the first delimiters, and replace each 
instance of it with whatever is found in the second delimiters. 

Therefore, it matches any of:

   * the range of characters A-Z
   * the range of characters a-z
   * the forward slash (which, as a "metacharacter", has to be escaped)
   * a space

The matched character is replaced with nothing (i.e. deleted).

The g "global" flag at the end causes this match to be repeated for all 
instances of the matched range throughout the $dose_density variable.

Therefore, it's deleting all letters, slashes, or spaces, and leaving 
behind whatever is left -- digits, other symbols, etc.


For more, an introductory Perl book would be a good place to turn, or if 
you want to focus on this aspect of Perl in depth, _Mastering Regular 
Expressions_ is a fantastically detailed overview of the subject.



-- 
Chris Devers      [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/

np: 'audio_2005.04.24.2_last_three_songs_of_main_set'
     by The Dresden Dolls
     from 'Live at the Paradise Rock Club - 04.24.2005'

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to