in reply to Re: foreach type of deal?
in thread foreach type of deal?
#!/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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: foreach type of deal?
by huck (Prior) on Mar 15, 2017 at 20:41 UTC | |
by hoagies (Initiate) on Mar 15, 2017 at 20:56 UTC | |
by huck (Prior) on Mar 15, 2017 at 21:19 UTC | |
by hoagies (Initiate) on Mar 15, 2017 at 21:47 UTC | |
by huck (Prior) on Mar 15, 2017 at 21:50 UTC | |
| |
by kennethk (Abbot) on Mar 15, 2017 at 21:46 UTC |