Showing posts with label perl. Show all posts
Showing posts with label perl. Show all posts

Wednesday

Stock analysis program using Perl and MySQL


Attach showing part of the perl code that write stock information to MySQL database. The completed code should able to read input list of stock to monitor from a text file, analyse SGX daily stock price in HTML file and write price and other information into a MySQL database.

At present, the program is able to analyse sgx HTML file and write data into MySQL. But the column alignment is a bit out.

Software used/installed
Perl - version 5.10
DBI
DBD-mysql

Heidi GUI for MySQL

Future work
Create a java program that reads from DB and display previous stock price record.

Monday

Perl - random number generator


The program is written in perl. The motivation to write this script is to generate a random list of numbers that will serve as input to another of my on-going software project.

Objective of this program
1. To create an output which contains random 2-decimal places numbers.

Perl command used:
rand
open
print
sprintf


Requirement
To accept 3 user command inputs (count, filename, step)

Output
a file (filename) with number of lines specified by count

random number with 2 decimal places is generated assigned to y
step determines increment of x.