Re: Problem reading files

2010-10-17 Thread Kryten
I got to the bottom of this now. The file had previously been encrypted. Doh! Thanks, Stuart -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Problem reading files

2010-10-16 Thread Kryten
Hi, I'm hitting a strange problem running simple perlscript on my new laptop. To illustrate:- #!/usr/bin/perl use strict; use warnings; use diagnostics; open my $configuration, 'H:\temp.txt' or die "my error: $!" ; my @info = <$configuration> ; chomp (@info); foreach my $i (@info) { print "$i\n

Re: Recursively filter an array

2010-09-02 Thread Kryten
Wow. Thank you Shlomi, Thank you Chas and Thank you Shawn. Hash sets seem to be the way to go here. Much quickness too! Here is what I have ( the least I can do is give you all a chance to laugh at my code! ):- #!/usr/bin/perl use warnings ; my $names_file = 'C:\names.log' ; my $exclude_list =

Recursively filter an array

2010-09-01 Thread Kryten
Hi, I'm very much a beginner. Could anyone point me in the right direction on how to accomplish the following, please? I have a fairly long log file call it file A, it has around 20,000 lines of three element space separated variables. File A looks like:- 55223 jimmy smith 55224 davy crocket 5

next in foreach loop

2010-08-12 Thread Kryten
Hi, Complete newbie. Is there any way to use "next" from within a foreach loop? All the examples I have seen/read use a while loop to demo. Thanks, Stuart -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Newbie stuck at the first hurdle

2010-04-24 Thread Kryten
Thank you Thomas. The problem was indeed the use of a double quoted string which was wrecking my file path. Using the $! var helped me to see that. "Learning Perl" and "Programming Perl" both arrived today, thank goodness! Cheers, Stuart -- To unsubscribe, e-mail: beginners-unsubscr...@perl.o

Re: Newbie stuck at the first hurdle

2010-04-24 Thread Kryten
Hi Uri, Thanks for the response. I was using both Komodo Edit and Primalscript and didn't see a compile error, until I added the ref to $! then I could see that my filepath was being damaged because of the doublequotes. The reason I wondered about the full path was because I have been using Powe

Newbie stuck at the first hurdle

2010-04-22 Thread Kryten
Hi, This is embarrassing. All I want to do is read the content of a simple 10 line .txt file into an array and print out the lines, and I just can't seem to get it to work! /* $target = "D:\testfile.txt"; open NEWBIE, "<"$target"; @arr = ; foreach $line (@arr) { print "$line\n"; } close(NEWBIE) *