Perl and a lot of Perl code, especially modules, uses the Artistic
License: in a nutshell (IANAL) you can do what the heck
you want with the code, modifying it, extracting pieces
of it for your own usage, charging people for it, anything
as long as you don't call modified versions the same as the
original and distribute them without the author's consent.
The standard header for that kind of code is:
# Copyright (c) 2000 belize
# All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
Of course basic courtesy would dictate giving due credit
to the author.
As for other code, you really have to read the license.