Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Array Manipulation

by Jalcock501 (Sexton)
on Oct 08, 2013 at 08:41 UTC ( #1057377=note: print w/replies, xml ) Need Help??

in reply to Re: Array Manipulation
in thread Array Manipulation

Hi Kcott

There's not a lot to do to be fair, I need to remove the extension because I have files with the same name but different extensions. I'm trying to read them in and compare the different files. So I thought if I remove the extension in the array I can do something like this

#! /usr/bin/perl -w my @files= <*.in> for (@files) { remove extension } for my $file (@files) { open (IN, "<", "$") || die ("cannot open $"); open (OUT,"<", "$") || die ("cannot open $"); undef $/; my $in = <IN>; my $out = <OUT>; my @in = split /\n/, $in; my @out = split /\n/, $out; my @final; for $a (@in) { my @result = grep/^\Q$a\E$/, @out; push (@final , @result); } print "Search string that matches against general data:\t@final"; }
I hope this makes a little more sense.

Replies are listed 'Best First'.
Re^3: Array Manipulation
by kcott (Chancellor) on Oct 08, 2013 at 09:07 UTC
    "There's not a lot to do to be fair, ..."

    My comment, "That's very little to go on.", was written before you updated your OP and added code. I updated my initial response after you added code to your OP.

    Based on the limited information you initially provided, by first response involved a certain amount of guesswork. Once you had provided some code, I was able to provide a much better answer: including pointers to where you went wrong and references to supporting documentation.

    So, had you provided your code initially, you wouldn't have needed to update your post or respond to my post (except, perhaps, to say thankyou). Similarly, I would only have needed to post once, instead of three times.

    There are distinct benefits to following the guidelines in "How do I post a question effectively?". Hopefully, this exercise has highlighted that.

    -- Ken

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057377]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2017-05-29 16:59 GMT
Find Nodes?
    Voting Booth?