in reply to Re: Removing Single Quote Problem
in thread Removing Single Quote Problem

Still having problems, here is more of the code
foreach my $item (@{$rss->{'items'}}) { next unless defined($item->{'title'}) && defined($item->{'link +'}) && defined($item->{'description'}); $i += 1; next if $i > $feedcount; $item->{'description'}=~s/\n//gms; #$item->{'description'} =~ tr/\n'//d; $item->{'description'}=~s/'//gms; $output .= "'<font size=2><b><a target=\"_blank\" href=\"$item +->{'link'}\">$item->{'title'}</a></b></font><br /><font size=1>$item- +>{'description'}</font><br />'+\n"; }

Replies are listed 'Best First'.
Re^3: Removing Single Quote Problem
by phaylon (Curate) on Feb 10, 2005 at 19:56 UTC
    What problems? I would also recommend reading perlstyle
    next unless defined($item->{'title'}) && defined($item->{'link +'}) && defined($item->{'description'});
    could be written as
    next unless defined $item->{title} and defined $item->{link} and defined $item->{description};
    Also, why are you setting $output after trying to strip the singlequotes?

    Ordinary morality is for ordinary people. -- A.C.
      I like
      next if grep !defined, @$item{qw(title link description)};
      But it would be nice if the OP would do a better job of describing the problem(s).

      Caution: Contents may have been coded under pressure.
      How does your suggestion improve the code? Perlstyle doesn't say that we have to use "and" rather than "&&". I find "&&" more readable.
        It doesn't. It is just more readable. The better one can read and understand your problem the better he can help. And that's why we're here, huh? :D

        Ordinary morality is for ordinary people. -- A.C.