Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Output to another file help

by roboticus (Chancellor)
on Nov 08, 2012 at 21:21 UTC ( #1002986=note: print w/ replies, xml ) Need Help??


in reply to [SOLVED] Output to another file help

jaffinito34:

You're treating $firstName as an array reference, but it's presumably a string. What you want to do is create a variable that holds the first initial, then you can print that. Something like this:

my $firstName = 'Marco'; my $firstInitial = substr($firstName, 0, 1); print "First initial is '$firstInitial'\n";

Read the documentation for substr to see how it works.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Output to another file help
Select or Download Code
Re^2: Output to another file help
by jaffinito34 (Acolyte) on Nov 08, 2012 at 21:36 UTC

    PERFECT!, any ideas how to quickly convert the firstInitial to lowercase? Right now my script outputs the first initial, first 3 of the last name, and last 4 of ssn, but it does so that it looks like this:

    First, Last, 000-000-0000, etc...

    output: FLas0000

    I'm trying to get it like: flas0000

Re^2: Output to another file help
by jaffinito34 (Acolyte) on Nov 08, 2012 at 21:39 UTC

    Nevermind, found out about lc() function.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002986]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2015-07-02 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (34 votes), past polls