Perl Snippets

From Facebook Developer Wiki

Jump to: navigation, search
# Retrieve Data stored in key value pairs in
# comment blocks within the FBML of a user's 
# profile box.
sub getData {
	my $id = shift;
	my %data;
	$_ = $fbk->profile->get_fbml(uid => $id);
	while ( /<!--(.*)-->/g ) { 
		$_ = $1; 
		while ( /(\S+)\s+(\S+)/g ) {
			$data{$1} = $2;
		}
	}
	return %data;
}
reference