in reply to Re: next unless not working
in thread next unless not working

Good point. Playing around with qwen2.5-coder it came up with the below version incorporating both this suggestion and some of mine.

use warnings; use strict; my $file_path = "/Users/anaordonez/Documents/my_languages.txt"; open(my $fh, '<', $file_path) or die "Sorry!! couldn't open '$file_pa +th': $!"; print "Reading file \n"; while (my $line = <$fh>) { chomp $line; print "$line\n" if $line eq "Java"; } close($fh);

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^3: next unless not working
by marto (Cardinal) on Feb 05, 2025 at 17:23 UTC

    Curious, does the LLM explain why these changes should be made? If so can you please post the output?

      Soitanly, nyuk nyuk. I'm using aider talking to a local ollama running qwen2.5-coder and put it in "architect mode" and asked:

      behave as an experienced perl programmer. Look at the attached perl script and give 2-3 suggestions for improvement.

      Edit: Reading back it also caught (but didn't mention) the line ending problem and added chomp which I actually missed. And it improved (but didn't call out) the error message as I mentioned by moving the path into a variable and adding it to the output with $! on the end.

      Second edit: Added output running with deepseek-r1:14b afterwards with the reasoning included.