Q:

Need to create regular expression for one file having sentence

L02    TIME DEPOSITS                             489,26,45,422.92                                                   
L18    DRAFTS ACCOUNT (IF CREDIT)                10,063.00           10,063.00                                                
L21    SBI BILLS ACCOUNT (CONTRA) A18                              37,51,432.00 
A12A   DEMAND LOANS                                               4,39,13,597.30                      

These are the lines I have in my file I want to extract the amounts from each line which starts with either (L or A) and store into a variable.   
This  is what I have written 
pattern =/[A-Z]\w+\s*([\d,.]*)\s*([\d,.])*/g
$first = $1;
$second= $2;  

A:

Your regex is looking for a string of \w and then spaces in the middle so it cannot match multiple words. The last * should be inside the parenthesis, like the first one (but see below). The [A-Z] matches any block capital while you say that you want A or L, so use [AL] instead.
my @amounts = $string =~ /^[AL]\w+ \s+ [A-Za-z ]* ([\d,.]*)/xg;

You don't want to literally repeat the pattern with * quantifier in order to account for a variable number of occurrences. What if 2 becomes 3  when requirements change? Four? Instead, you can capture all matches in an array and get exactly as many as there are.
The /x allows us to use spaces inside for readability.

Here is another approach, which is more flexible.
You need a pattern containing any of digit, , (comma), . (period) -- and which is only such in the string. You want this only on lines that start with A or L.
So skip lines which do not start with A or L, then match only the needed pattern.
use warnings;
use strict;

my $filename = '...';
open my $fh, '<', $filename or die "Can't open $filename: $!";

while (<$fh>)
{
    next unless /^[AL]/;   # skip if the line doesn't start with A or L

    my @amounts = $_ =~ /\b ([\d,.]+) \b/xg;

    print "@amounts\n" if @amounts;
}
close $fh;

Here you need to specify \b, the word boundary.  Otherwise 02 in L02 is matched, for example.
With no matches the array is empty so we test, to not print empty lines. Adjust as suitable.

The next step in reducing reliance on regex details and making code more flexible is to split the line by spaces and process term by term. Then adjustments are far easier and changes can be absorded.
For example, this helps with the change in data mentioned in a comment -- what if there is a date? The above regex would match the numeric parts, while the first one would just break down.
With a loop over fields on each line we can just skip the date, next if /\d{4}-\d{2}/;

