-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqif_parse.pl
More file actions
39 lines (36 loc) · 1.31 KB
/
qif_parse.pl
File metadata and controls
39 lines (36 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use Finance::QIF;
my $qif = Finance::QIF->new( file => "/Users/mark/Desktop/fs.qif" );
while ( my $record = $qif->next ) {
print( "", $record->{header}, "\n" );
foreach my $key ( keys %{$record} ) {
next
if ( $key eq "header"
|| $key eq "splits"
|| $key eq "budget"
|| $key eq "prices" );
print( " ", $key, ": ", $record->{$key}, "\n" );
}
if ( exists( $record->{splits} ) ) {
foreach my $split ( @{ $record->{splits} } ) {
foreach my $key ( keys %{$split} ) {
print( " Split: ", $key, ": ", $split->{$key}, "\n" );
}
}
}
if ( exists( $record->{budget} ) ) {
print(" Budget: ");
foreach my $amount ( @{ $record->{budget} } ) {
print( " ", $amount );
}
print("\n");
}
if ( exists( $record->{prices} ) ) {
# print(" Date Close Max Min Volume\n");
# $format = " %8s %7.2f %7.2f %7.2f %-8d\n";
# foreach my $price ( @{ $record->{prices} } ) {
# printf( $format,
# $price->{"date"}, $price->{"close"}, $price->{"max"},
# $price->{"min"}, $price->{"volume"} );
# }
}
}