-
-
Save m-chaturvedi/b1e978fd7b4200857f8e78e7756aeabb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use warnings; | |
use strict; | |
# http://search.cpan.org/~zmij/Array-Utils-0.5/Utils.pm | |
use Array::Utils qw(:all); | |
# $/ is the input record separator | |
# local is because it's a global variable | |
local $/ = undef; | |
open(DATA, "<", $ARGV[0]) or die; | |
my $file_data = <DATA>; | |
# g if trying to globally match the pattern repeatedly | |
my @all_defs = ($file_data =~ /PREPROC_ADD_MACRO\(info,(.*?)\)/g ); | |
my @uniq_defs = unique(@all_defs); | |
# Find symmetric difference | |
my @repeat_defs = array_diff(@all_defs, @uniq_defs); | |
print join( "\n" , @repeat_defs)."\n"; | |
# Output of the script | |
# __INT32_MAX__ | |
# __INT64_MAX__ | |
# __INT8_MAX__ | |
# __INT_FAST16_MAX__ | |
# __INT_FAST16_TYPE__ | |
# __INT_FAST8_MAX__ | |
# __UINT16_MAX__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment