Not sure what you want, really, but to remove the last 5 chars from a $string, you can do
substr( $string, -5, 5 ) = '';
UPDATE: I am still not sure what you want but it seems that there are groups of 4 lines and you want to shorten the second and fourth line of each group by 5 chars?
use strict;
use warnings;
use Data::Dumper;
my @lines = <DATA>; # assume groups of four lines
chomp( @lines );
my $n = 5; # to be cut off
for( my $i=0; $i<@lines; $i+=4 ) {
substr( $lines[$i+1], -$n, $n ) = '';
substr( $lines[$i+3], -$n, $n ) = '';
}
print Dumper( \@lines );
__DATA__
@HWI-ST1023:184:C1V8LACXX:7:1101:1142:2247 2:N:0:TGACCA
GTAGGGGCTGCGCGAACGCAAACCCCCGCTGCCACAAATGATCGTCGGACTGTAGAACTCTGAACGTGTA
+GATCTCGGTGGCCGCCGTATCATTAAAAAAA
+
?1=DBB@DCFFFFIGIIII6DGHHIII6@=AEEDDEEC;@C>@?(;;B;@B?9BCDAA3>(:@@CB+8(9
+>@:@CCBB289(259@B9B8?A:@C@>CC@B
@HWI-ST1023:184:C1V8LACXX:7:1101:1450:2022 2:N:0:TGACCA
ACGTGCCCTCGGCCAGAAGGCTTGGGGCGCAACTTGCGTTCAAAGACTCGATGGTTCACGGGATTCTGCA
+ATTCACACCAAGTATCGCATTTCGCTACGTT
+
?@@DDDFFADFFHIJIIFG>FHIJJJJJGIIBH=DHGHHDDFFF;AEAC?=>CD-:@CDBDBDBDD>CDD
+D:ACDCDDDDD?(4>CBBD?@DDDDDDDD8?
@HWI-ST1023:184:C1V8LACXX:7:1101:1457:2047 2:N:0:TGACCA
GCGTCGCCAGCACAGAGGCCATGCGATCCGTCGAGTTATCATGAATCATCAGAGCAACGGGCAGAGCCCG
+CGTCGACCTTTTATCTAATAAATGCGTCCCT
+
@CCDFFFFGHHHHJIIIJJIJJJJIIJJJJFHIBFBFHIGJJIGI@GHGGEHHHHHHFFDDABDDDDDDD
+DDDDBDBBBDCCCCCDDDDCDDEECB8<@DD
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|