in reply to Re: print and extract the line
in thread print and extract the line

Sorry It does not seem the output that i want it is like i have posted the wrong question with different meaning

As I want is

have a file A in one line

ASDSSDSDDDAAAAEDCDALSOSSKDQWSDSD

i want to extract where say from 4 to 8

and the output print is

SSDSD

Replies are listed 'Best First'.
Re^3: print and extract the line
by Marshall (Canon) on Jul 07, 2010 at 15:59 UTC
    To extract a subset of characters from a string, use substr(). See substr.

    #!usr/bin/perl -w use strict; my $x = 'ASDSSDSDDDAAAAEDCDALSOSSKDQWSDSD'; print substr($x,4-1,8-4+1); #strings start at index 0 and not index 1. #prints SSDSD