Mohammad S Anwar > BankAccount-Validator-UK-0.02 > BankAccount::Validator::UK



Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: BankAccount-Validator-UK-0.25


BankAccount::Validator::UK - Interface to validate UK bank account.


Version 0.02


The module uses the algorithm provided by VOCALINK to validate the bank sort code and account number. It is done by modulus checking method as specified in the document which is available on their website

It currently supports the document version 2.40 published on 23rd April'2012.

Institutions covered by this document are below:


If the modulus check shows the account number as valid this means that the account number is a possible account number for the sorting code but does'nt necessarily mean that it's an account number being used at that sorting code. Any account details found as invalid should be checked with the account holder where possible.



The constructor simply expects debug flag, which is optional. By the default the debug flag is off.

    use strict; use warnings;
    use BankAccount::Validator::UK;
    my ($account);
    # Debug is turned off.
    $account = BankAccount::Validator::UK->new();
    # Debug is turned on.
    $account = BankAccount::Validator::UK->new(1);


It expects two(2) parameters, first the sort code & then the account number. The sort code can be either nn-nn-nn or nnnnnn format. If the account number starts with 0 then its advisable to pass in as string i.e. '0nnnnnnn'.

    use strict; use warnings;
    use BankAccount::Validator::UK;
    my $account = BankAccount::Validator::UK->new();
    print "[10-79-99][88837491] is valid.\n" 
        if $account->is_valid(107999, 88837491);
    print "[18-00-02][00000190] is valid.\n" 
        if $account->is_valid('18-00-02', '00000190');


Returns the trace information about each rule that was applied to the given sortcode & account number.

    use strict; use warnings;
    use Data::Dumper;
    use BankAccount::Validator::UK;

    my $account = BankAccount::Validator::UK->new();
    print "[87-14-27][09123496] is valid.\n" 
        if $account->is_valid('871427', '09123496');

    print "Trace information:\n" . Dumper($account->get_trace());


Mohammad S Anwar, <mohammad.anwar at>


Please report any bugs or feature requests to bug-bankaccount-validator-uk at, or through the web interface at I will be notified, & then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc BankAccount::Validator::UK

You can also look for information at:


Copyright 2012 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either : the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.


This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: