#!/usr/bin/perl use strict; use warnings; main(@ARGV); sub main { open(FH, "gtype.txt"); foreach( my $line = <FH> ) { s/^g//; #toolic's idea. } } close FH; #and kennethk's idea #!/usr/bin/perl use strict; use warnings; main(@ARGV); sub main { open(FH, "gtype.txt"); while( my $line = <FH> ){ substr($_,1); # Start with the second letter } }
So, using kennethk's input, I kind of hacked this up...? I can kind of see how it works...
I looked at the perldocs linked in the replies, and I'm still working through them trying to understand all the various differences.
the file I'm working with looks something like this:gOrd_3342.png
gOrd_3343.png
500k of those going down a file. I need to leave all 500k of those with "Ord_xxxx.png. I have yet to try either of mentioned options, but my idea here is to figure this out and learn at the same time, and not simply get an answer I can plug in and call it quits. Thanks.
In reply to Re^2: foreach type of deal?
by hoagies
in thread foreach type of deal?
by hoagies
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |