Q: perl - cutting many strings with given array of numbers dear my fellow perl masters in the world~!
I need your help.
I have a string file A and a number file B like this:
File A: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

...and so on till 200.
File B: 
3, 6, 2, 5, 6, 1, ... 2 

(total 200 numbers in an array)
then, with the numbers in file B, I would like to cut each string from the start position to the number of characters in File B.
E.g. as File B starts with 3, 6, 2 ...
File A will be
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

like this.
So. this is my code so far...
use strict;

if (@ARGV != 2) {
    print "Invalid usage\n";
    print "Usahe: perl program.pl [num_list] [string_file]\n";
    exit(0);
}

my $numbers=$ARGV[0];
my $strings=$ARGV[1];
my $i;

open(LIST,$number);
open(DATA,$strings);

my @list = <LIST>;
my $list_size = scalar @sp_list;


for ($i=0;$i<=$list_size;$i++) {
    print $i,"\n";
    #while (my $line = <DATA>) {    
    }   


close(LIST);
close(DATA);

As the strings and numbers are 200 I changed the array into a scalar value to work on every numbers of every strings.
I'm working on this. and I know I suppose to use a pos function but i do not know how to match each number with each string. is reading the string first by while? or using for to know how many time that I have to run this to achieve the result?
Your help will be much appreciated!
Thank you.
I will be working on it, too. Need your feedback.

A: It is good that you use strict, and you should also use warnings. Further things to note:
You should check the return value of open to make sure they did not fail. You should also use the three argument form of open and use a lexical file handle. Especially when handling command line arguments, which does pose a security risk.
open my $listfh, "<", $file or die $!;

You may wish to use a safety precaution
use ARGV::readonly;

You can easily make the list of numbers with a map statement. Assuming the numbers are in a comma separated list:
my @list = map split(/\s*,\s*/), <$listfh>;

This will split the input line(s) on comma and strip excess whitespace.
When reading your input file, you do not need to use a counter variable. You can simply do
open my $inputfh, "<", $file or die $!;
while (<$inputfh>) {
    my $length = shift @list;   # these are your numbers
    chomp;                      # remove newline 
    my $string = substr($_, 0, -$length);  # negative length on substr
    print "$string\n";
}

The negative length on substr makes it leave that many characters off the end of the string.
Here is a one-liner in action that demonstrates these principles:
perl -lwe '$f = pop;                            # save file name for later
           @nums = map split(/\s*,\s*/), <>;    # process first file
           push @ARGV, $f;                      # put back file name
           while (<>) { 
                my $len = shift @nums; 
                chomp; 
                print substr($_,0,-$len); 
           }' fileb.txt filea.txt

Output:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEEEEEE

Note the use of implicit open of file name arguments by manipulating @ARGV. Also handling newlines with -l switch.

A: Here is my suggestion. It does use autodie so that there is no need to explicitly check the status of open calls, and temporarily undefines $/ - the input record separator - so that all of the num_list file is read in one go. You aren't clear whether this file will always contain just single line, in which case you can omit local $/.
The numbers are extracted from the text using a regular expression /\d+/g returns all the strings of digits in the input as a list.
The second parameter to substr is the start position of the substring you want, and using a negative number counts from the end of the string instead of the beginning. The third parameter is the number of characters in the substring, and the fourth is a string to replace that substring in the target variable. So substr $data, -$n, $n, '' replaces the substring of length $n starting $n characters from the end with an empty string - i.e. it deletes it.
Note that if it is your intention to remove the given number of characters from the beginning of the string, then you would write  substr $data, 0, $n, '' instead.
use strict;
use warnings;
use autodie;

unless (@ARGV == 2) {
  print "Usage: perl program.pl [num_list] [string_file]\n";
  exit;
}

my @numbers;
{
  open my $listfh, '<', $ARGV[0];
  local $/;
  my $numbers = <$listfh>;
  @numbers = $numbers =~ /\d+/g;
};


open my $datafh, '<', $ARGV[1];

for my $i (0 .. $#numbers) {
  print "$i\n";
  my $n = $numbers[$i];
  my $data = <$datafh>;
  chomp $data;
  substr $data, -$n, $n, '';
  print "$data\n";
}   


A: Here is how I would do it. substr is the function to remove a part of a string. From your example, it is not clear whether you want to remove the characters at the beginning or at the end. Both alternatives are shown here:
#!/usr/bin/perl
use warnings;
use strict;

if (@ARGV != 2) {
    die "Invalid usage\n"
        . "Usage: perl program.pl [num_list] [string_file]\n";
}

my ($number_f, $string_f) = @ARGV;

open my $LIST, '<', $number_f or die "Cannot open $number_f: $!";
my @numbers = split /, */, <$LIST>;
close $LIST;

open my $DATA, '<', $string_f or die "Cannot open $string_f: $!";
while (my $string = <$DATA>) {
    substr $string, 0, shift @numbers, q(); # Replace the first n characters with an empty string.

    # To remove the trailing portion, replace the previous line with the following:
    # my $n = shift @numbers;
    # substr $string, -$n-1, $n, q();

    print $string;
}

You were not checking the return value of open. Try to remember to always do that.
Do not declare variables far before you are going to use them ($i here).
Do not use C-style for loops if you do not have to. They are prone to fence post errors.

A: You can use substr():
use strict;
use warnings;

if (@ARGV != 2) {
    print "Invalid usage\n";
    print "Usage: perl program.pl [num_list] [string_file]\n";
    exit(0);
}

my $numbers=$ARGV[0];
my $strings=$ARGV[1];

open my $list, '<', $numbers or die "Can't open $numbers: $!";
open my $data, '<', $strings or die "Can't open $strings: $!";

chomp(my $numlist = <$list>);
my @numbers = split /\s*,\s*/,$numlist;
for my $chop_length (@numbers)
{
   my $data = <$data> // die "not enough data in $strings";
   print substr($data,0,length($data)-$chop_length)."\n";
}


A: Your specs say you want "... to cut each string from the start position to the number of characters in File B."  I agree with choroba that it's not perfectly clear whether characters from the start or the end of the string are to be cut.  However, I tend to think that you want to remove characters from the beginning when you say, "... from the start position ...", but a string like ABCDEFGHIJKLMNOPQRSTUVWXYZ012345 would help clarify this issue.
This option is not as well self-documenting as the other solutions, but a discussion of it will follow:
use strict;
use warnings;

@ARGV == 2 or die "Usage: perl program.pl [num_list] [string_file]\n";

open my $fh, '<', pop or die "Cannot open string file: $!";
chomp( my @str = <$fh> );

local $/ = ', ';

while (<>) {
    chomp;
    print +( substr $str[ $. - 1 ], $_ ) . "\n";
}

Strings:
ABCDEFGHIJKLMNOPQRSTUVWXYZ012345
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

Numbers:
3, 6, 2, 5, 6

Output:
DEFGHIJKLMNOPQRSTUVWXYZ012345
BBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEEEEEEEE

The strings' file name is poped off @ARGV (since an explicit argument for pop is not used) and passed to open to read the strings into @str.  The record separator is set to ', ' so chomp leaves only the number.  The current line number in $. is used as part of the index to the corresponding @str element, and the remaining characters in the string from n on are printed.
