Skip to content

Commit 74ab769

Browse files
committed
add pack("x")
1 parent 0057949 commit 74ab769

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

MILESTONES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ The following areas are currently under active development to enhance the functi
314314
- **v5.42.2**: Next minor version
315315

316316
- Add special variables: `@{^CAPTURE}`, `${^LAST_SUCCESSFUL_PATTERN}`.
317+
- Add pack format `x`.
317318
- Bugfix in regex `/r`.
318319
- Bugfix in transliterate with octal values.
319320
- Bugfix in nested heredocs.

src/main/java/org/perlonjava/operators/Pack.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ public static RuntimeScalar pack(RuntimeList args) {
113113
PackHelper.writeUuencodedString(output, str);
114114
} else if (format == 'a' || format == 'A' || format == 'Z') {
115115
valueIndex = handleStringFormat(valueIndex, values, hasStar, format, count, byteMode, output);
116+
} else if (format == 'x') {
117+
for (int j = 0; j < count; j++) {
118+
output.write(0);
119+
}
116120
} else {
117121
// Numeric formats
118122
for (int j = 0; j < count; j++) {

0 commit comments

Comments
 (0)