Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Noob could use advice on simplification & optimization

by brx (Pilgrim)
on May 03, 2012 at 21:06 UTC ( [id://968809]=note: print w/replies, xml ) Need Help??


in reply to Noob could use advice on simplification & optimization

Nothing important to say, except bravo! :)

Anyway some advice you could follow if you really insist :) (I can't test your script)

use strict; use warnings;

'for' loops: try the perlish syntax

for(my $i = $#data; $i > 0; $i--) { if ($data[$i] =~ /\|/) { $last_line = $data[$i]; $i=0; # correct line found, exit loop. } } # or # for my $line (reverse @data) { $last_line = $line; last if $line =~ /\|/; }

line 70 - you don't need @result:

( $directory, $search_string, ..., $scan_down...) = split('|',$last_line);

line 136: you could use 'join':

print SAVED_SEARCH (join '|', $directory, $search_string, ..., $scan_down..., "\n");

Replies are listed 'Best First'.
Re^2: Noob could use advice on simplification & optimization
by bgreg (Initiate) on May 03, 2012 at 21:54 UTC
    Cool, thanks for the response. I'll definitely make these changes. Using strict is going to be a challenge for me, this code isn't organized for that right now.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://968809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-03-19 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found