Search Results

Search: Posts Made By: schultz2146
5,118
Posted By schultz2146
Thank you for taking the time explain what now...
Thank you for taking the time explain what now seems such a simple question. These basic exercises do prove challenging for new students to the perl language. But with the help of the great world of...
5,118
Posted By schultz2146
I never seem to give enough information when I...
I never seem to give enough information when I post.. sorry about that.

The test string, if I ever got it to seperat correctly, was going to seperat the dollar amount and assigne it to an array...
5,118
Posted By schultz2146
The actual code I used was a simple test...
The actual code I used was a simple test string...


$test="This is a test $6.56 $5.7";
print split(/\$/, $test);

which resulted the

This is a test .56 .7

However with your example the...
5,118
Posted By schultz2146
Unix Perl split special character $
All I'm trying to split a string at the $ into arrays

@data:=<dataFile>
a $3.33
b $4.44
dfg $0.56

The split command I have been playing with is:
split(/\$/, @data)

which results with...
59,525
Posted By schultz2146
So if below works on a single column datafile of ...
So if below works on a single column datafile of
Apple
B34
Cat
112
245
356

Outputs to screen:
112 Apple
245 B34
356 Cat

open(FILE, "<", "dataFile");
while(<FILE>) {
chomp;
if ($_...
59,525
Posted By schultz2146
so how do I trap entries with alphanum??
We can trap colums with alpha [:alpha;], numeric \d... So how can we trap colums with alphanum without catching everything?

if ($_ =~ /^[[:alpha:]]+$/) {
push @stringArray, $_;
} elsif ($_...
59,525
Posted By schultz2146
got it to work.. but one more Q
#!/usr/bin/perl -w
open(FILE, ">", "dataFile");
while(<FILE>) {
chomp;
if ($_ =~ /^[[:alpha:]]+$/) {push @stringArray, $_; }
elsif ($_ =~ /^\d+$/) {push @intArray, $_;}
}
close(FILE);...
59,525
Posted By schultz2146
perl -write num array and string array from dataFile
Locking this thread would be a travesty.. Newbies like myself need these strings of information to help elevate us to a higher level of understanding of a lang seasoned programmers take for granted....
Showing results 1 to 8 of 8

 
All times are GMT -4. The time now is 04:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy