Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: how can i increase the size of a record in a file

by Kenosis (Priest)
on Feb 07, 2013 at 07:00 UTC ( #1017578=note: print w/ replies, xml ) Need Help??


in reply to how can i increase the size of a record in a file

The output string you shared has a length of 212, which is 40 fewer than the record size of 252--and you have exactly 40 empty fields, i.e., ||, in that string. If you filled each empty field with a character, e.g., an "X", you'd have a 252-byte record. Is this what you want to do? Since the records are | delimited, why does each record need to be 252 bytes?

If you do want to fill all the empty fields with an "X" (or some other character) you can do the following with the string:

$string =~ s/(?<=\|)(?=\|)/X/g;

However, it would be far better to address the data in your variables before creating that string.

My apologies if I've misunderstood your problem.

Update I: Athanasius makes an excellent point about the "|" character; I merely assumed it was the field delimiter.

Update II: Eliminating elements in your original posting makes your issue(s) a moving target and nullifies some responses; e.g., you've removed the record-size 'problem.' Nevertheless, your reformatting evidences a newline in one of your variables, and by the break in your output string, you should be able to tell which variable and then remove the newline.


Comment on Re: how can i increase the size of a record in a file
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-12-19 00:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (69 votes), past polls