> I am using the following piece of code to check > to see if on line 23 the word 'Running' appears > between pos 11 and 19. > > I have two questions. > > 1. Is this the correct format to do this?
The style police are being kept at bay by unrulely Perl users, who keep chanting "There's More Than One Way To Do It". ;-) However, sometimes another approach is easier to maintain/read, so please allow me to have a go. My version looks like: # Open workflow.txt (better if we knew what this file was). open (WORKFLOW, '..\..\workflow.txt') or die "Cannot open Workflow $!\n"; # Extract 23rd line. my $line; do {$line = <WORKFLOW>} until $. == 23 || eof; unless ($. == 23) { die "workflow.txt isn't even 23 lines long!\n" }; # Find position of "Running" after, but starting at position 11. my $position = index($line, "Running", 11); # Unless it appears between positions 11 and 19 we wish to send an email. if ($position == -1 or $position > 19) { # Send that email NOW! } # Close the file now we are finished. close (WORKFLOW) or die "Cannot close Workflow $!\n"; > 2. How can I just output that area that I am > checking to make sure it is looking at the > right place? My version should work just fine, but if you want try: $. = 20; do {print "$.: " . <WORKFLOW>} until $. == 26 || eof; Enjoy, Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]