in reply to Re: Problem with <> and regex
in thread *fixed*Problem with <> and regex

The first solution did indeed delete my entire line, but the second option just crashes the script :(. This is what fails:
sub clean { my ($words) = @_; print "WordsBefore: $words \n"; $word =~ s/<[^>]+>//g; print "WordsAfter: $words \n"; return $words; }

Replies are listed 'Best First'.
Re^3: Problem with <> and regex
by golux (Chaplain) on Mar 11, 2014 at 15:23 UTC
    How exactly is it "crashing your script"? Is it providing any error message? Any output?

    Edit:   I just noticed that you're passing "$words", but then operating on "$word", which is probably your error. Granted you probably cut and paste what I wrote (so the error is actually mine -- sorry!). Change "$word" to "$words".

    You should also have:

    use strict; use warnings;
    at the top of your script (maybe you do, and that's why your script was failing). If not, add them; they'll tell you what you're doing wrong in exactly this type of situation.
    say  substr+lc crypt(qw $i3 SI$),4,5