Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

fuzzy logic?

by softworkz (Monk)
on May 24, 2001 at 16:20 UTC ( #82873=perlquestion: print w/replies, xml ) Need Help??

softworkz has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: fuzzy logic?
by mr.nick (Chaplain) on May 24, 2001 at 18:14 UTC
    This is untested, but should work just fine.
    sub process_file { my $file=shift; open(IN,"<$file") || die "Couldn't open '$file': $!\n"; my @in=(<IN>)[0..9]; close IN; if (join('',@in)=~/\r\n/m) { ## found! ## do something exciting here } }

    Update It would probably be more intellient to

    push @in,scalar <IN> for 1..10;
    as my original code seems to snarf the entire file and THEN return the first 10 lines.
Re: (Zigster) fuzzy logic?
by zigster (Hermit) on May 24, 2001 at 17:13 UTC
    Do you really only want to look only at the first 10 lines? Do a Super Search for nodes re "dos unix convert" there are several describing how to do the conversion and how to identify the files to be converted.

    Note. Please consider carefuly how you name your nodes. This is a very common question and I am sure other monks would, in the future value being able to find information from this thread. However with the current name the information is likely to be lost. When naming consider what you would search for if you were looking for the answer to your own question, then other people can learn from your experience.


Re: fuzzy logic?
by Masem (Monsignor) on May 24, 2001 at 17:00 UTC
    This can be done with straightforward logic through, nothing fuzzy about it.

    The trickiest part is determining if the first 10 lines of the file met your expectations to run the program, but this can be done via regex.

    Dr. Michael K. Neylon - || "You've left the lens cap of your mind on again, Pinky" - The Brain

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://82873]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-05-20 06:58 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (72 votes). Check out past polls.