It helps to read the documentation of the software you are working with. Call the get_style_by_selector
method with a .green
argument to find the styles.
use CSS qw();
my $css = CSS->new;
$css->read_string('.red { clear: both; } .green { clear: both; }');
$css->get_style_by_selector('.green')->to_string;